diff --git a/example_app_generator/generate_stuff.rb b/example_app_generator/generate_stuff.rb index 7363e14090..8386a92a7b 100644 --- a/example_app_generator/generate_stuff.rb +++ b/example_app_generator/generate_stuff.rb @@ -44,6 +44,7 @@ def setup_tasks def final_tasks copy_file 'spec/verify_no_active_record_spec.rb' + copy_file 'spec/verify_no_fixture_setup_spec.rb' end def skip_active_record? diff --git a/example_app_generator/no_active_record/spec/verify_no_fixture_setup_spec.rb b/example_app_generator/no_active_record/spec/verify_no_fixture_setup_spec.rb new file mode 100644 index 0000000000..d3ec9b7e6b --- /dev/null +++ b/example_app_generator/no_active_record/spec/verify_no_fixture_setup_spec.rb @@ -0,0 +1,22 @@ +# Pretend that ActiveRecord::Rails is defined and this doesn't blow up +# with `config.use_active_record = false`. +# Trick the other spec that checks that ActiveRecord is +# *not* defined by wrapping it in RSpec::Rails namespace +# so that it's reachable from RSpec::Rails::FixtureSupport. +# NOTE: this has to be defined before requiring `rails_helper`. +module RSpec + module Rails + module ActiveRecord + module TestFixtures + end + end + end +end + +require 'rails_helper' + +RSpec.describe 'Example App', :use_fixtures, type: :model do + it "does not set up fixtures" do + expect(defined?(fixtures)).not_to be + end +end