@@ -13,5 +13,51 @@ module RSpec::Rails
13
13
expect ( group ) . to respond_to ( :fixture_path= )
14
14
end
15
15
end
16
+
17
+ context "without database available" do
18
+ before { clear_active_record_connection }
19
+
20
+ after { establish_active_record_connection }
21
+
22
+ context "with use_active_record set to true" do
23
+ before { RSpec . configuration . use_active_record = true }
24
+
25
+ it "raise due to no connection established" do
26
+ example_group = RSpec ::Core ::ExampleGroup . describe ( "FixtureSupport" ) do
27
+ include FixtureSupport
28
+ include RSpec ::Rails ::MinitestLifecycleAdapter
29
+ end
30
+
31
+ test = example_group . example ( "foo" ) do
32
+ expect ( true ) . to be ( true )
33
+ end
34
+
35
+ expect ( example_group . run ) . to be ( false )
36
+ expect ( test . execution_result . exception ) . to \
37
+ be_a ( ActiveRecord ::ConnectionNotEstablished )
38
+ end
39
+ end
40
+
41
+ context "with use_active_record set to false" do
42
+ before { RSpec . configuration . use_active_record = false }
43
+
44
+ after { RSpec . configuration . use_active_record = true }
45
+
46
+ it "does not raise" do
47
+ example_group = RSpec ::Core ::ExampleGroup . describe ( "FixtureSupport" ) do
48
+ include FixtureSupport
49
+ include RSpec ::Rails ::MinitestLifecycleAdapter
50
+ end
51
+
52
+ test = example_group . example ( "foo" ) do
53
+ expect ( true ) . to be ( true )
54
+ end
55
+
56
+ expect ( example_group . run ) . to be ( true )
57
+ expect ( test . execution_result . exception ) . not_to \
58
+ be_a ( ActiveRecord ::ConnectionNotEstablished )
59
+ end
60
+ end
61
+ end
16
62
end
17
63
end
0 commit comments