@@ -21,7 +21,7 @@ class SearchInAHaystack < ActiveRecord::Base
21
21
22
22
Search . connection . drop_view :searches
23
23
24
- silence_stream ( STDOUT ) { eval ( output ) }
24
+ silence_stream ( $stdout ) { eval ( output ) }
25
25
26
26
expect ( Search . first . haystack ) . to eq "needle"
27
27
end
@@ -37,14 +37,15 @@ class SearchInAHaystack < ActiveRecord::Base
37
37
expect ( output ) . to include "~ '\\ \\ d+'::text"
38
38
39
39
Search . connection . drop_view :searches
40
- silence_stream ( STDOUT ) { eval ( output ) }
40
+ silence_stream ( $stdout ) { eval ( output ) }
41
41
42
42
expect ( Search . first . haystack ) . to eq "needle"
43
43
end
44
44
45
45
it "dumps a create_view for a materialized view in the database" do
46
46
view_definition = "SELECT 'needle'::text AS haystack"
47
- Search . connection . create_view :searches , materialized : true , sql_definition : view_definition
47
+ Search . connection . create_view :searches , materialized : true ,
48
+ sql_definition : view_definition
48
49
stream = StringIO . new
49
50
50
51
ActiveRecord ::SchemaDumper . dump ( Search . connection , stream )
@@ -59,7 +60,8 @@ class SearchInAHaystack < ActiveRecord::Base
59
60
it "dumps a create_view including namespace for a view in the database" do
60
61
view_definition = "SELECT 'needle'::text AS haystack"
61
62
Search . connection . execute "CREATE SCHEMA scenic; SET search_path TO scenic, public"
62
- Search . connection . create_view :"scenic.searches" , sql_definition : view_definition
63
+ Search . connection . create_view :"scenic.searches" ,
64
+ sql_definition : view_definition
63
65
stream = StringIO . new
64
66
65
67
ActiveRecord ::SchemaDumper . dump ( Search . connection , stream )
@@ -74,7 +76,8 @@ class SearchInAHaystack < ActiveRecord::Base
74
76
it "handles active record table name prefixes and suffixes" do
75
77
with_affixed_tables ( prefix : "a_" , suffix : "_z" ) do
76
78
view_definition = "SELECT 'needle'::text AS haystack"
77
- Search . connection . create_view :a_searches_z , sql_definition : view_definition
79
+ Search . connection . create_view :a_searches_z ,
80
+ sql_definition : view_definition
78
81
stream = StringIO . new
79
82
80
83
ActiveRecord ::SchemaDumper . dump ( Search . connection , stream )
@@ -102,7 +105,8 @@ class SearchInAHaystack < ActiveRecord::Base
102
105
context "with views using unexpected characters in name" do
103
106
it "dumps a create_view for a view in the database" do
104
107
view_definition = "SELECT 'needle'::text AS haystack"
105
- Search . connection . create_view '"search in a haystack"' , sql_definition : view_definition
108
+ Search . connection . create_view '"search in a haystack"' ,
109
+ sql_definition : view_definition
106
110
stream = StringIO . new
107
111
108
112
ActiveRecord ::SchemaDumper . dump ( Search . connection , stream )
@@ -113,7 +117,7 @@ class SearchInAHaystack < ActiveRecord::Base
113
117
114
118
Search . connection . drop_view :'"search in a haystack"'
115
119
116
- silence_stream ( STDOUT ) { eval ( output ) }
120
+ silence_stream ( $stdout ) { eval ( output ) }
117
121
118
122
expect ( SearchInAHaystack . take . haystack ) . to eq "needle"
119
123
end
@@ -126,7 +130,7 @@ class SearchInAHaystack < ActiveRecord::Base
126
130
"CREATE SCHEMA scenic; SET search_path TO scenic, public" ,
127
131
)
128
132
Search . connection . create_view 'scenic."search in a haystack"' ,
129
- sql_definition : view_definition
133
+ sql_definition : view_definition
130
134
stream = StringIO . new
131
135
132
136
ActiveRecord ::SchemaDumper . dump ( Search . connection , stream )
@@ -137,7 +141,7 @@ class SearchInAHaystack < ActiveRecord::Base
137
141
138
142
Search . connection . drop_view :'scenic."search in a haystack"'
139
143
140
- silence_stream ( STDOUT ) { eval ( output ) }
144
+ silence_stream ( $stdout ) { eval ( output ) }
141
145
142
146
expect ( SearchInAHaystack . take . haystack ) . to eq "needle"
143
147
end
0 commit comments