diff options
author | yui-knk <spiketeika@gmail.com> | 2015-11-22 19:22:36 +0900 |
---|---|---|
committer | yui-knk <spiketeika@gmail.com> | 2015-11-28 10:50:11 +0900 |
commit | f8f7e66f5fe393136755ebd00c49cf4081a5dc12 (patch) | |
tree | 3fbba9e5bf0d51f27507dc3d14be93740c1d5f86 /actionpack/test | |
parent | 4596c1a31902806a15c970a0e210942912b139b6 (diff) | |
download | rails-f8f7e66f5fe393136755ebd00c49cf4081a5dc12.tar.gz rails-f8f7e66f5fe393136755ebd00c49cf4081a5dc12.tar.bz2 rails-f8f7e66f5fe393136755ebd00c49cf4081a5dc12.zip |
Brush up errors of `ActionDispatch::Routing::Mapper#mount`
* Integrate to raise `ArgumentError`
* Detailed error message when `path` is not defined
* Add a test case, invalid rack app is passed
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/mapper_test.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index e783df855e..df27e41997 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -158,7 +158,7 @@ module ActionDispatch assert_equal '/*path.:format', fakeset.asts.first.to_s end - def test_raising_helpful_error_on_invalid_arguments + def test_raising_error_when_path_is_not_passed fakeset = FakeSet.new mapper = Mapper.new fakeset app = lambda { |env| [200, {}, [""]] } @@ -166,6 +166,18 @@ module ActionDispatch mapper.mount app end end + + def test_raising_error_when_rack_app_is_not_passed + fakeset = FakeSet.new + mapper = Mapper.new fakeset + assert_raises ArgumentError do + mapper.mount 10, as: "exciting" + end + + assert_raises ArgumentError do + mapper.mount as: "exciting" + end + end end end end |