@@ -100,10 +100,10 @@ def test_retrieves_comment_from_cache_when_enabled_and_set
100
100
ActiveRecord ::QueryLogs . cache_query_log_tags = true
101
101
ActiveRecord ::QueryLogs . tags = [ :application ]
102
102
103
- assert_equal " /*application:active_record*/" , ActiveRecord ::QueryLogs . call ( "" )
103
+ assert_equal "/*application:active_record*/" , ActiveRecord ::QueryLogs . call ( "" )
104
104
105
105
ActiveRecord ::QueryLogs . stub ( :cached_comment , "/*cached_comment*/" ) do
106
- assert_equal " /*cached_comment*/" , ActiveRecord ::QueryLogs . call ( "" )
106
+ assert_equal "/*cached_comment*/" , ActiveRecord ::QueryLogs . call ( "" )
107
107
end
108
108
ensure
109
109
ActiveRecord ::QueryLogs . cached_comment = nil
@@ -115,12 +115,12 @@ def test_resets_cache_on_context_update
115
115
ActiveRecord ::QueryLogs . update_context ( temporary : "value" )
116
116
ActiveRecord ::QueryLogs . tags = [ temporary_tag : -> ( context ) { context [ :temporary ] } ]
117
117
118
- assert_equal " /*temporary_tag:value*/" , ActiveRecord ::QueryLogs . call ( "" )
118
+ assert_equal "/*temporary_tag:value*/" , ActiveRecord ::QueryLogs . call ( "" )
119
119
120
120
ActiveRecord ::QueryLogs . update_context ( temporary : "new_value" )
121
121
122
122
assert_nil ActiveRecord ::QueryLogs . cached_comment
123
- assert_equal " /*temporary_tag:new_value*/" , ActiveRecord ::QueryLogs . call ( "" )
123
+ assert_equal "/*temporary_tag:new_value*/" , ActiveRecord ::QueryLogs . call ( "" )
124
124
ensure
125
125
ActiveRecord ::QueryLogs . cached_comment = nil
126
126
ActiveRecord ::QueryLogs . cache_query_log_tags = false
@@ -149,58 +149,6 @@ def test_default_tag_behavior
149
149
end
150
150
end
151
151
152
- def test_inline_tags_only_affect_block
153
- # disable regular comment tags
154
- ActiveRecord ::QueryLogs . tags = [ ]
155
-
156
- # confirm single inline tag
157
- assert_sql ( %r{/\* foo\* /$} ) do
158
- ActiveRecord ::QueryLogs . with_tag ( "foo" ) do
159
- Dashboard . first
160
- end
161
- end
162
-
163
- # confirm different inline tag
164
- assert_sql ( %r{/\* bar\* /$} ) do
165
- ActiveRecord ::QueryLogs . with_tag ( "bar" ) do
166
- Dashboard . first
167
- end
168
- end
169
-
170
- # confirm no tags are persisted
171
- ActiveRecord ::QueryLogs . tags = [ :application ]
172
-
173
- assert_sql ( %r{/\* application:active_record\* /$} ) do
174
- Dashboard . first
175
- end
176
- ensure
177
- ActiveRecord ::QueryLogs . tags = [ :application ]
178
- end
179
-
180
- def test_nested_inline_tags
181
- assert_sql ( %r{/\* foobar\* /$} ) do
182
- ActiveRecord ::QueryLogs . with_tag ( "foo" ) do
183
- ActiveRecord ::QueryLogs . with_tag ( "bar" ) do
184
- Dashboard . first
185
- end
186
- end
187
- end
188
- end
189
-
190
- def test_bad_inline_tags
191
- assert_sql ( %r{/\* ; DROP TABLE USERS;\* /$} ) do
192
- ActiveRecord ::QueryLogs . with_tag ( "*/; DROP TABLE USERS;/*" ) do
193
- Dashboard . first
194
- end
195
- end
196
-
197
- assert_sql ( %r{/\* ; DROP TABLE USERS;\* /$} ) do
198
- ActiveRecord ::QueryLogs . with_tag ( "**//; DROP TABLE USERS;//**" ) do
199
- Dashboard . first
200
- end
201
- end
202
- end
203
-
204
152
def test_empty_comments_are_not_added
205
153
original_tags = ActiveRecord ::QueryLogs . tags
206
154
ActiveRecord ::QueryLogs . tags = [ empty : -> { nil } ]
0 commit comments