Skip to content

Commit

Permalink
fixup! Add a smoke test to make sure fixtures are not included
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Mar 12, 2020
1 parent 2b54146 commit 87a03e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions example_app_generator/generate_stuff.rb
Expand Up @@ -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?
Expand Down
@@ -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

0 comments on commit 87a03e4

Please sign in to comment.