From e2735b2b32db5de76c39d953b1e6339ecb19e24d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 12 Aug 2015 15:17:21 -0700 Subject: add a regression test for adding arbitrary keys to `scope` --- actionpack/test/dispatch/mapper_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index 9076dab0c0..3071890521 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -27,6 +27,10 @@ module ActionDispatch routes << args end + def defaults + routes.map { |x| x[3] } + end + def conditions routes.map { |x| x[1] } end @@ -48,6 +52,17 @@ module ActionDispatch end end + def test_random_keys + fakeset = FakeSet.new + mapper = Mapper.new fakeset + mapper.scope(omg: :awesome) do + mapper.get '/', :to => 'posts#index', :as => :main + end + assert_equal({:omg=>:awesome, :controller=>"posts", :action=>"index"}, + fakeset.defaults.first) + assert_equal ["GET"], fakeset.conditions.first[:request_method] + end + def test_mapping_requirements options = { } scope = Mapper::Scope.new({}) -- cgit v1.2.3