js-routes 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Readme.md +1 -1
- data/lib/js_routes/generators/middleware.rb +1 -1
- data/lib/js_routes/instance.rb +1 -1
- data/lib/js_routes/middleware.rb +6 -2
- data/lib/js_routes/version.rb +1 -1
- data/lib/routes.d.ts +1 -0
- data/lib/routes.js +13 -2
- data/lib/routes.ts +12 -2
- data/spec/js_routes/default_serializer_spec.rb +4 -4
- data/spec/js_routes/module_types/amd_spec.rb +1 -1
- data/spec/js_routes/module_types/cjs_spec.rb +1 -1
- data/spec/js_routes/module_types/dts/routes.spec.d.ts +1 -0
- data/spec/js_routes/module_types/esm_spec.rb +2 -2
- data/spec/js_routes/module_types/nil_spec.rb +7 -7
- data/spec/js_routes/options_spec.rb +79 -79
- data/spec/js_routes/rails_routes_compatibility_spec.rb +123 -136
- data/spec/js_routes/route_specification_spec.rb +40 -0
- data/spec/spec_helper.rb +4 -0
- metadata +3 -2
@@ -37,7 +37,7 @@ describe JsRoutes, "options" do
|
|
37
37
|
it "should set configurable serializer" do
|
38
38
|
# expect the nonsense serializer above to have appened foo=bar
|
39
39
|
# to the end of the path
|
40
|
-
|
40
|
+
expectjs(%q(Routes.inboxes_path())).to eql("/inboxes?foo=bar")
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -57,7 +57,7 @@ describe JsRoutes, "options" do
|
|
57
57
|
|
58
58
|
it "uses JS serializer" do
|
59
59
|
evaljs("Routes.configure({serializer: function (object, prefix) { return 'bar=baz'; }})")
|
60
|
-
|
60
|
+
expectjs(%q(Routes.inboxes_path({a: 1}))).to eql("/inboxes?bar=baz")
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -67,18 +67,18 @@ describe JsRoutes, "options" do
|
|
67
67
|
let(:_options) { {:exclude => /^admin_/} }
|
68
68
|
|
69
69
|
it "should exclude specified routes from file" do
|
70
|
-
|
70
|
+
expectjs("Routes.admin_users_path").to be_nil
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should not exclude routes not under specified pattern" do
|
74
|
-
|
74
|
+
expectjs("Routes.inboxes_path()").not_to be_nil
|
75
75
|
end
|
76
76
|
|
77
77
|
context "for rails engine" do
|
78
78
|
let(:_options) { {:exclude => /^blog_app_posts/} }
|
79
79
|
|
80
80
|
it "should exclude specified engine route" do
|
81
|
-
|
81
|
+
expectjs("Routes.blog_app_posts_path").to be_nil
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -88,22 +88,22 @@ describe JsRoutes, "options" do
|
|
88
88
|
let(:_options) { {:include => /^admin_/} }
|
89
89
|
|
90
90
|
it "should exclude specified routes from file" do
|
91
|
-
|
91
|
+
expectjs("Routes.admin_users_path()").not_to be_nil
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should not exclude routes not under specified pattern" do
|
95
|
-
|
95
|
+
expectjs("Routes.inboxes_path").to be_nil
|
96
96
|
end
|
97
97
|
|
98
98
|
context "with camel_case option" do
|
99
99
|
let(:_options) { {include: /^admin_/, camel_case: true} }
|
100
100
|
|
101
101
|
it "should exclude specified routes from file" do
|
102
|
-
|
102
|
+
expectjs("Routes.adminUsersPath()").not_to be_nil
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should not exclude routes not under specified pattern" do
|
106
|
-
|
106
|
+
expectjs("Routes.inboxesPath").to be_nil
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -111,7 +111,7 @@ describe JsRoutes, "options" do
|
|
111
111
|
let(:_options) { {:include => /^blog_app_posts/} }
|
112
112
|
|
113
113
|
it "should include specified engine route" do
|
114
|
-
|
114
|
+
expectjs("Routes.blog_app_posts_path()").not_to be_nil
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -121,13 +121,13 @@ describe JsRoutes, "options" do
|
|
121
121
|
let(:_options) { {:prefix => "/myprefix/" } }
|
122
122
|
|
123
123
|
it "should render routing with prefix" do
|
124
|
-
|
124
|
+
expectjs("Routes.inbox_path(1)").to eq("/myprefix#{test_routes.inbox_path(1)}")
|
125
125
|
end
|
126
126
|
|
127
127
|
it "should render routing with prefix set in JavaScript" do
|
128
128
|
evaljs("Routes.configure({prefix: '/newprefix/'})")
|
129
|
-
|
130
|
-
|
129
|
+
expectjs("Routes.config().prefix").to eq("/newprefix/")
|
130
|
+
expectjs("Routes.inbox_path(1)").to eq("/newprefix#{test_routes.inbox_path(1)}")
|
131
131
|
end
|
132
132
|
|
133
133
|
end
|
@@ -137,7 +137,7 @@ describe JsRoutes, "options" do
|
|
137
137
|
let(:_options) { {:prefix => "http://localhost:3000" } }
|
138
138
|
|
139
139
|
it "should render routing with prefix" do
|
140
|
-
|
140
|
+
expectjs("Routes.inbox_path(1)").to eq(_options[:prefix] + test_routes.inbox_path(1))
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -146,12 +146,12 @@ describe JsRoutes, "options" do
|
|
146
146
|
let(:_options) { {:prefix => "/myprefix" } }
|
147
147
|
|
148
148
|
it "should render routing with prefix" do
|
149
|
-
|
149
|
+
expectjs("Routes.inbox_path(1)").to eq("/myprefix#{test_routes.inbox_path(1)}")
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should render routing with prefix set in JavaScript" do
|
153
153
|
evaljs("Routes.configure({prefix: '/newprefix/'})")
|
154
|
-
|
154
|
+
expectjs("Routes.inbox_path(1)").to eq("/newprefix#{test_routes.inbox_path(1)}")
|
155
155
|
end
|
156
156
|
|
157
157
|
end
|
@@ -162,30 +162,30 @@ describe JsRoutes, "options" do
|
|
162
162
|
|
163
163
|
if Rails.version >= "5"
|
164
164
|
it "should render routing with default_format" do
|
165
|
-
|
165
|
+
expectjs("Routes.inbox_path(1)").to eq(test_routes.inbox_path(1))
|
166
166
|
end
|
167
167
|
|
168
168
|
it "should render routing with default_format and zero object" do
|
169
|
-
|
169
|
+
expectjs("Routes.inbox_path(0)").to eq(test_routes.inbox_path(0))
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
173
|
it "should override default_format when spefified implicitly" do
|
174
|
-
|
174
|
+
expectjs("Routes.inbox_path(1, {format: 'xml'})").to eq(test_routes.inbox_path(1, :format => "xml"))
|
175
175
|
end
|
176
176
|
|
177
177
|
it "should override nullify implicitly when specified implicitly" do
|
178
|
-
|
178
|
+
expectjs("Routes.inbox_path(1, {format: null})").to eq(test_routes.inbox_path(1, format: nil))
|
179
179
|
end
|
180
180
|
|
181
181
|
it "shouldn't require the format" do
|
182
|
-
|
182
|
+
expectjs("Routes.json_only_path()").to eq(test_routes.json_only_path)
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
186
|
it "shouldn't include the format when {:format => false} is specified" do
|
187
|
-
|
188
|
-
|
187
|
+
expectjs("Routes.no_format_path()").to eq(test_routes.no_format_path())
|
188
|
+
expectjs("Routes.no_format_path({format: 'json'})").to eq(test_routes.no_format_path(format: 'json'))
|
189
189
|
end
|
190
190
|
|
191
191
|
describe "default_url_options" do
|
@@ -193,21 +193,21 @@ describe JsRoutes, "options" do
|
|
193
193
|
context "provided by the default_url_options" do
|
194
194
|
let(:_options) { { :default_url_options => { :optional_id => "12", :format => "json" } } }
|
195
195
|
it "should use this options to fill optional parameters" do
|
196
|
-
|
196
|
+
expectjs("Routes.things_path()").to eq(test_routes.things_path(12))
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
200
|
context "provided inline by the method parameters" do
|
201
201
|
let(:options) { { :default_url_options => { :optional_id => "12" } } }
|
202
202
|
it "should overwrite the default_url_options" do
|
203
|
-
|
203
|
+
expectjs("Routes.things_path({ optional_id: 34 })").to eq(test_routes.things_path(optional_id: 34))
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
207
|
context "not provided" do
|
208
208
|
let(:_options) { { :default_url_options => { :format => "json" } } }
|
209
209
|
it "breaks" do
|
210
|
-
|
210
|
+
expectjs("Routes.foo_all_path()").to eq(test_routes.foo_all_path)
|
211
211
|
end
|
212
212
|
end
|
213
213
|
end
|
@@ -215,19 +215,19 @@ describe JsRoutes, "options" do
|
|
215
215
|
context "with required route parts" do
|
216
216
|
let(:_options) { { :default_url_options => { :inbox_id => "12" } } }
|
217
217
|
it "should use this options to fill optional parameters" do
|
218
|
-
|
218
|
+
expectjs("Routes.inbox_messages_path()").to eq(test_routes.inbox_messages_path)
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
222
|
context "with optional and required route parts" do
|
223
223
|
let(:_options) { {:default_url_options => { :optional_id => "12" } } }
|
224
224
|
it "should use this options to fill the optional parameters" do
|
225
|
-
|
225
|
+
expectjs("Routes.thing_path(1)").to eq test_routes.thing_path(1, { optional_id: "12" })
|
226
226
|
end
|
227
227
|
|
228
228
|
context "when passing options that do not have defaults" do
|
229
229
|
it "should use this options to fill the optional parameters" do
|
230
|
-
|
230
|
+
expectjs("Routes.thing_path(1, { format: 'json' })").to eq test_routes.thing_path(1, { optional_id: "12", format: "json" } ) # test_routes.thing_path needs optional_id here to generate the correct route. Not sure why.
|
231
231
|
end
|
232
232
|
end
|
233
233
|
end
|
@@ -236,7 +236,7 @@ describe JsRoutes, "options" do
|
|
236
236
|
let(:_options) { { :default_url_options => { :format => "json" } } }
|
237
237
|
it "uses JS defined value" do
|
238
238
|
evaljs("Routes.configure({default_url_options: {format: 'xml'}})")
|
239
|
-
|
239
|
+
expectjs("Routes.inboxes_path()").to eq(test_routes.inboxes_path(format: 'xml'))
|
240
240
|
end
|
241
241
|
end
|
242
242
|
end
|
@@ -245,33 +245,33 @@ describe JsRoutes, "options" do
|
|
245
245
|
context "with default option" do
|
246
246
|
let(:_options) { Hash.new }
|
247
247
|
it "should working in params" do
|
248
|
-
|
248
|
+
expectjs("Routes.inbox_path(1, {trailing_slash: true})").to eq(test_routes.inbox_path(1, :trailing_slash => true))
|
249
249
|
end
|
250
250
|
|
251
251
|
it "should working with additional params" do
|
252
|
-
|
252
|
+
expectjs("Routes.inbox_path(1, {trailing_slash: true, test: 'params'})").to eq(test_routes.inbox_path(1, :trailing_slash => true, :test => 'params'))
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
256
|
context "with default_url_options option" do
|
257
257
|
let(:_options) { {:default_url_options => {:trailing_slash => true}} }
|
258
258
|
it "should working" do
|
259
|
-
|
259
|
+
expectjs("Routes.inbox_path(1, {test: 'params'})").to eq(test_routes.inbox_path(1, :trailing_slash => true, :test => 'params'))
|
260
260
|
end
|
261
261
|
|
262
262
|
it "should remove it by params" do
|
263
|
-
|
263
|
+
expectjs("Routes.inbox_path(1, {trailing_slash: false})").to eq(test_routes.inbox_path(1, trailing_slash: false))
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
267
|
context "with disabled default_url_options option" do
|
268
268
|
let(:_options) { {:default_url_options => {:trailing_slash => false}} }
|
269
269
|
it "should not use trailing_slash" do
|
270
|
-
|
270
|
+
expectjs("Routes.inbox_path(1, {test: 'params'})").to eq(test_routes.inbox_path(1, :test => 'params'))
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should use it by params" do
|
274
|
-
|
274
|
+
expectjs("Routes.inbox_path(1, {trailing_slash: true})").to eq(test_routes.inbox_path(1, :trailing_slash => true))
|
275
275
|
end
|
276
276
|
end
|
277
277
|
end
|
@@ -280,18 +280,18 @@ describe JsRoutes, "options" do
|
|
280
280
|
context "with default option" do
|
281
281
|
let(:_options) { Hash.new }
|
282
282
|
it "should use snake case routes" do
|
283
|
-
|
284
|
-
|
283
|
+
expectjs("Routes.inbox_path(1)").to eq(test_routes.inbox_path(1))
|
284
|
+
expectjs("Routes.inboxPath").to be_nil
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
288
|
context "with true" do
|
289
289
|
let(:_options) { { :camel_case => true } }
|
290
290
|
it "should generate camel case routes" do
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
291
|
+
expectjs("Routes.inbox_path").to be_nil
|
292
|
+
expectjs("Routes.inboxPath").not_to be_nil
|
293
|
+
expectjs("Routes.inboxPath(1)").to eq(test_routes.inbox_path(1))
|
294
|
+
expectjs("Routes.inboxMessagesPath(10)").to eq(test_routes.inbox_messages_path(:inbox_id => 10))
|
295
295
|
end
|
296
296
|
end
|
297
297
|
end
|
@@ -300,8 +300,8 @@ describe JsRoutes, "options" do
|
|
300
300
|
context "with default option" do
|
301
301
|
let(:_options) { Hash.new }
|
302
302
|
it "should generate only path links" do
|
303
|
-
|
304
|
-
|
303
|
+
expectjs("Routes.inbox_path(1)").to eq(test_routes.inbox_path(1))
|
304
|
+
expectjs("Routes.inbox_url").to be_nil
|
305
305
|
end
|
306
306
|
end
|
307
307
|
|
@@ -310,19 +310,19 @@ describe JsRoutes, "options" do
|
|
310
310
|
let(:_options) { { :url_links => true, :default_url_options => {:host => "example.com"} } }
|
311
311
|
|
312
312
|
it "uses the specified host, defaults protocol to http, defaults port to 80 (leaving it blank)" do
|
313
|
-
|
313
|
+
expectjs("Routes.inbox_url(1)").to eq("http://example.com#{test_routes.inbox_path(1)}")
|
314
314
|
end
|
315
315
|
|
316
316
|
it "does not override protocol when specified in route" do
|
317
|
-
|
317
|
+
expectjs("Routes.new_session_url()").to eq("https://example.com#{test_routes.new_session_path}")
|
318
318
|
end
|
319
319
|
|
320
320
|
it "does not override host when specified in route" do
|
321
|
-
|
321
|
+
expectjs("Routes.sso_url()").to eq(test_routes.sso_url)
|
322
322
|
end
|
323
323
|
|
324
324
|
it "does not override port when specified in route" do
|
325
|
-
|
325
|
+
expectjs("Routes.portals_url()").to eq("http://example.com:8080#{test_routes.portals_path}")
|
326
326
|
end
|
327
327
|
end
|
328
328
|
|
@@ -330,19 +330,19 @@ describe JsRoutes, "options" do
|
|
330
330
|
let(:_options) { { :url_links => true, :default_url_options => {:host => "example.com", :protocol => "ftp"} } }
|
331
331
|
|
332
332
|
it "uses the specified protocol and host, defaults port to 80 (leaving it blank)" do
|
333
|
-
|
333
|
+
expectjs("Routes.inbox_url(1)").to eq("ftp://example.com#{test_routes.inbox_path(1)}")
|
334
334
|
end
|
335
335
|
|
336
336
|
it "does not override protocol when specified in route" do
|
337
|
-
|
337
|
+
expectjs("Routes.new_session_url()").to eq("https://example.com#{test_routes.new_session_path}")
|
338
338
|
end
|
339
339
|
|
340
340
|
it "does not override host when host is specified in route" do
|
341
|
-
|
341
|
+
expectjs("Routes.sso_url()").to eq("ftp://sso.example.com#{test_routes.sso_path}")
|
342
342
|
end
|
343
343
|
|
344
344
|
it "does not override port when specified in route" do
|
345
|
-
|
345
|
+
expectjs("Routes.portals_url()").to eq("ftp://example.com:8080#{test_routes.portals_path}")
|
346
346
|
end
|
347
347
|
end
|
348
348
|
|
@@ -350,40 +350,40 @@ describe JsRoutes, "options" do
|
|
350
350
|
let(:_options) { { :url_links => true, :default_url_options => {:host => "example.com", :port => 3000} } }
|
351
351
|
|
352
352
|
it "uses the specified host and port, defaults protocol to http" do
|
353
|
-
|
353
|
+
expectjs("Routes.inbox_url(1)").to eq("http://example.com:3000#{test_routes.inbox_path(1)}")
|
354
354
|
end
|
355
355
|
|
356
356
|
it "does not override protocol when specified in route" do
|
357
|
-
|
357
|
+
expectjs("Routes.new_session_url()").to eq("https://example.com:3000#{test_routes.new_session_path}")
|
358
358
|
end
|
359
359
|
|
360
360
|
it "does not override host, protocol, or port when host is specified in route" do
|
361
|
-
|
361
|
+
expectjs("Routes.sso_url()").to eq("http://sso.example.com:3000" + test_routes.sso_path)
|
362
362
|
end
|
363
363
|
|
364
364
|
it "does not override parts when specified in route" do
|
365
|
-
|
365
|
+
expectjs("Routes.secret_root_url()").to eq(test_routes.secret_root_url)
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
369
|
context "with camel_case option" do
|
370
370
|
let(:_options) { { :camel_case => true, :url_links => true, :default_url_options => {:host => "example.com"} } }
|
371
371
|
it "should generate path and url links" do
|
372
|
-
|
372
|
+
expectjs("Routes.inboxUrl(1)").to eq("http://example.com#{test_routes.inbox_path(1)}")
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
376
376
|
context "with prefix option" do
|
377
377
|
let(:_options) { { :prefix => "/api", :url_links => true, :default_url_options => {:host => 'example.com'} } }
|
378
378
|
it "should generate path and url links" do
|
379
|
-
|
379
|
+
expectjs("Routes.inbox_url(1)").to eq("http://example.com/api#{test_routes.inbox_path(1)}")
|
380
380
|
end
|
381
381
|
end
|
382
382
|
|
383
383
|
context "with compact option" do
|
384
384
|
let(:_options) { { :compact => true, :url_links => true, :default_url_options => {:host => 'example.com'} } }
|
385
385
|
it "does not affect url helpers" do
|
386
|
-
|
386
|
+
expectjs("Routes.inbox_url(1)").to eq("http://example.com#{test_routes.inbox_path(1)}")
|
387
387
|
end
|
388
388
|
end
|
389
389
|
end
|
@@ -415,31 +415,31 @@ describe JsRoutes, "options" do
|
|
415
415
|
let(:_options) { { :url_links => true } }
|
416
416
|
|
417
417
|
it "uses the current host" do
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
418
|
+
expectjs("Routes.inbox_path").not_to be_nil
|
419
|
+
expectjs("Routes.inbox_url").not_to be_nil
|
420
|
+
expectjs("Routes.inbox_url(1)").to eq("http://current.example.com#{test_routes.inbox_path(1)}")
|
421
|
+
expectjs("Routes.inbox_url(1, { test_key: \"test_val\" })").to eq("http://current.example.com#{test_routes.inbox_path(1, :test_key => "test_val")}")
|
422
|
+
expectjs("Routes.new_session_url()").to eq("https://current.example.com#{test_routes.new_session_path}")
|
423
423
|
end
|
424
424
|
|
425
425
|
it "doesn't use current when specified in the route" do
|
426
|
-
|
426
|
+
expectjs("Routes.sso_url()").to eq(test_routes.sso_url)
|
427
427
|
end
|
428
428
|
|
429
429
|
it "uses host option as an argument" do
|
430
|
-
|
430
|
+
expectjs("Routes.secret_root_url({host: 'another.com'})").to eq(test_routes.secret_root_url(host: 'another.com'))
|
431
431
|
end
|
432
432
|
|
433
433
|
it "uses port option as an argument" do
|
434
|
-
|
434
|
+
expectjs("Routes.secret_root_url({host: 'localhost', port: 8080})").to eq(test_routes.secret_root_url(host: 'localhost', port: 8080))
|
435
435
|
end
|
436
436
|
|
437
437
|
it "uses protocol option as an argument" do
|
438
|
-
|
438
|
+
expectjs("Routes.secret_root_url({host: 'localhost', protocol: 'https'})").to eq(test_routes.secret_root_url(protocol: 'https', host: 'localhost'))
|
439
439
|
end
|
440
440
|
|
441
441
|
it "uses subdomain option as an argument" do
|
442
|
-
|
442
|
+
expectjs("Routes.secret_root_url({subdomain: 'custom'})").to eq(test_routes.secret_root_url(subdomain: 'custom'))
|
443
443
|
end
|
444
444
|
end
|
445
445
|
end
|
@@ -449,8 +449,8 @@ describe JsRoutes, "options" do
|
|
449
449
|
let(:_options) { { url_links: true } }
|
450
450
|
|
451
451
|
it 'generates path' do
|
452
|
-
|
453
|
-
|
452
|
+
expectjs("Routes.inbox_url(1)").to eq test_routes.inbox_path(1)
|
453
|
+
expectjs("Routes.new_session_url()").to eq test_routes.new_session_path
|
454
454
|
end
|
455
455
|
end
|
456
456
|
end
|
@@ -459,9 +459,9 @@ describe JsRoutes, "options" do
|
|
459
459
|
describe "when the compact mode is enabled" do
|
460
460
|
let(:_options) { { :compact => true } }
|
461
461
|
it "removes _path suffix from path helpers" do
|
462
|
-
|
463
|
-
|
464
|
-
|
462
|
+
expectjs("Routes.inbox_path").to be_nil
|
463
|
+
expectjs("Routes.inboxes()").to eq(test_routes.inboxes_path())
|
464
|
+
expectjs("Routes.inbox(2)").to eq(test_routes.inbox_path(2))
|
465
465
|
end
|
466
466
|
|
467
467
|
context "with url_links option" do
|
@@ -473,8 +473,8 @@ describe JsRoutes, "options" do
|
|
473
473
|
|
474
474
|
let(:_options) { { :compact => true, :url_links => true, default_url_options: {host: 'localhost'} } }
|
475
475
|
it "should not strip urls" do
|
476
|
-
|
477
|
-
|
476
|
+
expectjs("Routes.inbox(1)").to eq(test_routes.inbox_path(1))
|
477
|
+
expectjs("Routes.inbox_url(1)").to eq("http://localhost#{test_routes.inbox_path(1)}")
|
478
478
|
end
|
479
479
|
end
|
480
480
|
end
|
@@ -483,9 +483,9 @@ describe JsRoutes, "options" do
|
|
483
483
|
let(:_options) { { special_options_key: :__options__ } }
|
484
484
|
it "can be redefined" do
|
485
485
|
expect {
|
486
|
-
|
486
|
+
expectjs("Routes.inbox_message_path({inbox_id: 1, id: 2, _options: true})").to eq("")
|
487
487
|
}.to raise_error(js_error_class)
|
488
|
-
|
488
|
+
expectjs("Routes.inbox_message_path({inbox_id: 1, id: 2, __options__: true})").to eq(test_routes.inbox_message_path(inbox_id: 1, id: 2))
|
489
489
|
end
|
490
490
|
end
|
491
491
|
|
@@ -493,7 +493,7 @@ describe JsRoutes, "options" do
|
|
493
493
|
let(:_options) { {:application => BlogEngine::Engine} }
|
494
494
|
|
495
495
|
it "should include specified engine route" do
|
496
|
-
|
496
|
+
expectjs("Routes.posts_path()").not_to be_nil
|
497
497
|
end
|
498
498
|
end
|
499
499
|
|