Skip to content

Commit 7687d68

Browse files
Test Cleanup: Update bundle assertions
Rather than stub calls on Bundler, we simply assert the output of the generator to see if `bundle install` is called.
1 parent f62c516 commit 7687d68

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

test/generators/suspenders/accessibility_generator_test.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ class AccessibilityGeneratorTest < Rails::Generators::TestCase
5151
end
5252

5353
test "installs gems with Bundler" do
54-
Bundler.stubs(:with_unbundled_env).yields
55-
generator.expects(:run).with("bundle install").once
54+
output = run_generator
5655

57-
capture(:stdout) do
58-
generator.add_capybara_gems
59-
end
56+
assert_match(/bundle install/, output)
6057
end
6158

6259
test "generator has a description" do

test/generators/suspenders/factories_generator_test.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ class FactoriesGenerator::DefaultTest < Rails::Generators::TestCase
3232

3333
test "installs gem with Bundler" do
3434
with_test_suite :minitest do
35-
Bundler.stubs(:with_unbundled_env).yields
36-
generator.expects(:run).with("bundle install").once
35+
output = run_generator
3736

38-
capture(:stdout) do
39-
generator.add_factory_bot
40-
end
37+
assert_match(/bundle install/, output)
4138
end
4239
end
4340

test/generators/suspenders/inline_svg_generator_test.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ class InlinveSvgGeneratorTest < Rails::Generators::TestCase
4646
end
4747

4848
test "installs gems with Bundler" do
49-
Bundler.stubs(:with_unbundled_env).yields
50-
generator.expects(:run).with("bundle install").once
49+
output = run_generator
5150

52-
capture(:stdout) do
53-
generator.add_inline_svg_gem
54-
end
51+
assert_match(/bundle install/, output)
5552
end
5653

5754
test "generator has a description" do

0 commit comments

Comments
 (0)