Skip to content

Commit

Permalink
Add test of parsing numeric value from PrerequisitesGenerator#node_ve…
Browse files Browse the repository at this point in the history
…rsion

Co-authored-by: Steve Polito <[email protected]>
  • Loading branch information
louis-antonopoulos and stevepolitodesign committed Nov 1, 2024
1 parent 4a4dd50 commit a17f4d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/generators/suspenders/prerequisites_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ class PrerequisitesGeneratorTest < Rails::Generators::TestCase
end
end

test "#node_version parses out the version number from an alphanumeric value" do
ClimateControl.modify NODE_VERSION: nil do
Object.any_instance.stubs(:`).returns("v1.7.4\n")
actual = Suspenders::Generators::PrerequisitesGenerator.new.node_version

assert_match(/^1\.7\.4$/, actual)
end
end

test "generates .node-version file (from system)" do
Generators::PrerequisitesGenerator.any_instance.stubs(:node_version).returns("20.0.0")

Expand Down

0 comments on commit a17f4d6

Please sign in to comment.