@@ -12,7 +12,7 @@ def content_for(file_name)
1212 end
1313
1414 def have_a_fixture_path
15- match ( /config\. fixture_path/m )
15+ match ( /^ config\. fixture_path = /m )
1616 end
1717
1818 def maintain_test_schema
@@ -23,8 +23,16 @@ def require_rspec_rails
2323 match ( /^require 'rspec\/ rails'$/m )
2424 end
2525
26- def have_transactional_fixtures_enabled?
27- match ( /config\. use_transactional_fixtures/m )
26+ def have_active_record_enabled
27+ match ( /^\ # config\. use_active_record = false/m )
28+ end
29+
30+ def have_active_record_disabled
31+ match ( /^\ config\. use_active_record = false/m )
32+ end
33+
34+ def have_transactional_fixtures_enabled
35+ match ( /^ config\. use_transactional_fixtures = true/m )
2836 end
2937
3038 def filter_rails_from_backtrace
@@ -59,19 +67,24 @@ def filter_rails_from_backtrace
5967 expect ( rails_helper ) . to require_rspec_rails
6068 end
6169
62- specify "with transactional fixtures " do
70+ specify "with ActiveRecord " do
6371 run_generator
64- expect ( rails_helper ) . to have_a_fixture_path
72+ expect ( rails_helper ) . to have_active_record_enabled
73+ expect ( rails_helper ) . not_to have_active_record_disabled
6574 end
6675
6776 specify "with default fixture path" do
6877 run_generator
69- expect ( rails_helper ) . to have_transactional_fixtures_enabled?
78+ expect ( rails_helper ) . to have_a_fixture_path
7079 end
7180
72- specify "excluding rails gems from the backtrace " do
81+ specify "with transactional fixtures " do
7382 run_generator
83+ expect ( rails_helper ) . to have_transactional_fixtures_enabled
84+ end
7485
86+ specify "excluding rails gems from the backtrace" do
87+ run_generator
7588 expect ( rails_helper ) . to filter_rails_from_backtrace
7689 end
7790
@@ -86,26 +99,31 @@ def filter_rails_from_backtrace
8699 hide_const ( "ActiveRecord" )
87100 end
88101
89- it "requires rspec/rails" do
102+ specify "requiring rspec/rails" do
90103 run_generator
91104 expect ( rails_helper ) . to require_rspec_rails
92105 end
93106
94- it "does not include config.fixture_path" do
107+ specify "without ActiveRecord" do
108+ run_generator
109+ expect ( rails_helper ) . not_to have_active_record_enabled
110+ expect ( rails_helper ) . to have_active_record_disabled
111+ end
112+
113+ specify "without fixture path" do
95114 run_generator
96115 expect ( rails_helper ) . not_to have_a_fixture_path
97116 end
98117
99- it "does not include config.use_transactional_fixtures " do
118+ specify "without transactional fixtures " do
100119 run_generator
101- expect ( rails_helper ) . not_to have_transactional_fixtures_enabled?
120+ expect ( rails_helper ) . not_to have_transactional_fixtures_enabled
102121 end
103122
104- it "does not check use active record migration options " do
123+ specify "without schema maintenance checks " do
105124 run_generator
106125 expect ( rails_helper ) . not_to use_active_record_migration
107126 expect ( rails_helper ) . not_to maintain_test_schema
108127 end
109128 end
110-
111129end
0 commit comments