Skip to content

Commit 87a03e4

Browse files
committed
fixup! Add a smoke test to make sure fixtures are not included
1 parent 2b54146 commit 87a03e4

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

example_app_generator/generate_stuff.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def setup_tasks
4444

4545
def final_tasks
4646
copy_file 'spec/verify_no_active_record_spec.rb'
47+
copy_file 'spec/verify_no_fixture_setup_spec.rb'
4748
end
4849

4950
def skip_active_record?
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Pretend that ActiveRecord::Rails is defined and this doesn't blow up
2+
# with `config.use_active_record = false`.
3+
# Trick the other spec that checks that ActiveRecord is
4+
# *not* defined by wrapping it in RSpec::Rails namespace
5+
# so that it's reachable from RSpec::Rails::FixtureSupport.
6+
# NOTE: this has to be defined before requiring `rails_helper`.
7+
module RSpec
8+
module Rails
9+
module ActiveRecord
10+
module TestFixtures
11+
end
12+
end
13+
end
14+
end
15+
16+
require 'rails_helper'
17+
18+
RSpec.describe 'Example App', :use_fixtures, type: :model do
19+
it "does not set up fixtures" do
20+
expect(defined?(fixtures)).not_to be
21+
end
22+
end

0 commit comments

Comments
 (0)