Skip to content

Commit

Permalink
Ensure rails_helper is not modified is pre-configured
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepolitodesign committed Nov 10, 2023
1 parent 6f436bf commit e80f643
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/generators/suspenders/factories_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ class FactoriesGenerator::RSpecTest < Rails::Generators::TestCase
end
end

test "does not modify rails_helper if it's configured to include support files" do
touch("spec/rails_helper.rb")
rails_helper = <<~RUBY
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
RUBY
File.open(app_root("spec/rails_helper.rb"), "w") { _1.write rails_helper }

run_generator

assert_file app_root("spec/rails_helper.rb") do |file|
assert_equal rails_helper, file
end
end

test "creates linting test" do
factories_spec = <<~RUBY
require "rails_helper"
Expand Down

0 comments on commit e80f643

Please sign in to comment.