File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
lib/action_dispatch/routing Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1861,7 +1861,7 @@ def path_scope(path)
1861
1861
end
1862
1862
1863
1863
def map_match ( paths , options )
1864
- if options [ :on ] && !VALID_ON_OPTIONS . include? ( options [ :on ] )
1864
+ if ( on = options [ :on ] ) && !VALID_ON_OPTIONS . include? ( on )
1865
1865
raise ArgumentError , "Unknown scope #{ on . inspect } given to :on"
1866
1866
end
1867
1867
Original file line number Diff line number Diff line change @@ -193,6 +193,16 @@ def test_raising_error_when_rack_app_is_not_passed
193
193
end
194
194
end
195
195
196
+ def test_raising_error_when_invalid_on_option_is_given
197
+ fakeset = FakeSet . new
198
+ mapper = Mapper . new fakeset
199
+ error = assert_raise ArgumentError do
200
+ mapper . get "/foo" , on : :invalid_option
201
+ end
202
+
203
+ assert_equal "Unknown scope :invalid_option given to :on" , error . message
204
+ end
205
+
196
206
def test_scope_does_not_destructively_mutate_default_options
197
207
fakeset = FakeSet . new
198
208
mapper = Mapper . new fakeset
You can’t perform that action at this time.
0 commit comments