Skip to content

Commit e80f643

Browse files
Ensure rails_helper is not modified is pre-configured
1 parent 6f436bf commit e80f643

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/generators/suspenders/factories_generator_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,20 @@ class FactoriesGenerator::RSpecTest < Rails::Generators::TestCase
175175
end
176176
end
177177

178+
test "does not modify rails_helper if it's configured to include support files" do
179+
touch("spec/rails_helper.rb")
180+
rails_helper = <<~RUBY
181+
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
182+
RUBY
183+
File.open(app_root("spec/rails_helper.rb"), "w") { _1.write rails_helper }
184+
185+
run_generator
186+
187+
assert_file app_root("spec/rails_helper.rb") do |file|
188+
assert_equal rails_helper, file
189+
end
190+
end
191+
178192
test "creates linting test" do
179193
factories_spec = <<~RUBY
180194
require "rails_helper"

0 commit comments

Comments
 (0)