Skip to content

Commit

Permalink
Test Cleanup: Update bundle assertions (#1193)
Browse files Browse the repository at this point in the history
Rather than stub calls on Bundler, we simply assert the output of the
generator to see if `bundle install` is called.
  • Loading branch information
stevepolitodesign authored Apr 19, 2024
1 parent f62c516 commit 7952880
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 2 additions & 5 deletions test/generators/suspenders/accessibility_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ class AccessibilityGeneratorTest < Rails::Generators::TestCase
end

test "installs gems with Bundler" do
Bundler.stubs(:with_unbundled_env).yields
generator.expects(:run).with("bundle install").once
output = run_generator

capture(:stdout) do
generator.add_capybara_gems
end
assert_match(/bundle install/, output)
end

test "generator has a description" do
Expand Down
7 changes: 2 additions & 5 deletions test/generators/suspenders/factories_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ class FactoriesGenerator::DefaultTest < Rails::Generators::TestCase

test "installs gem with Bundler" do
with_test_suite :minitest do
Bundler.stubs(:with_unbundled_env).yields
generator.expects(:run).with("bundle install").once
output = run_generator

capture(:stdout) do
generator.add_factory_bot
end
assert_match(/bundle install/, output)
end
end

Expand Down
7 changes: 2 additions & 5 deletions test/generators/suspenders/inline_svg_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ class InlinveSvgGeneratorTest < Rails::Generators::TestCase
end

test "installs gems with Bundler" do
Bundler.stubs(:with_unbundled_env).yields
generator.expects(:run).with("bundle install").once
output = run_generator

capture(:stdout) do
generator.add_inline_svg_gem
end
assert_match(/bundle install/, output)
end

test "generator has a description" do
Expand Down

0 comments on commit 7952880

Please sign in to comment.