aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-12 15:17:21 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-12 15:17:21 -0700
commite2735b2b32db5de76c39d953b1e6339ecb19e24d (patch)
tree690fae804b594013ece9c1368021363fcbcef95b /actionpack/test
parent1c9431753939b9987416debf839d5707efe4dc18 (diff)
downloadrails-e2735b2b32db5de76c39d953b1e6339ecb19e24d.tar.gz
rails-e2735b2b32db5de76c39d953b1e6339ecb19e24d.tar.bz2
rails-e2735b2b32db5de76c39d953b1e6339ecb19e24d.zip
add a regression test for adding arbitrary keys to `scope`
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/mapper_test.rb15
1 files changed, 15 insertions, 0 deletions
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({})