Skip to content

Commit 0d10dc3

Browse files
jhawthornmatthewd
andcommitted
Add regression test for passing a hash to scope
Co-authored-by: Matthew Draper <[email protected]>
1 parent de1e6c9 commit 0d10dc3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

actionpack/test/dispatch/routing_test.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,10 +2107,32 @@ def test_resource_merges_options_from_scope
21072107
end
21082108
end
21092109

2110+
assert_equal "/account", account_path
21102111
assert_raise(NoMethodError) { new_account_path }
21112112

21122113
get "/account/new"
21132114
assert_equal 404, status
2115+
2116+
get "/account"
2117+
assert_equal 200, status
2118+
end
2119+
2120+
def test_resource_merges_options_from_scope_hash
2121+
draw do
2122+
scope_options = { only: :show }
2123+
scope scope_options do
2124+
resource :account
2125+
end
2126+
end
2127+
2128+
assert_equal "/account", account_path
2129+
assert_raise(NoMethodError) { new_account_path }
2130+
2131+
get "/account/new"
2132+
assert_equal 404, status
2133+
2134+
get "/account"
2135+
assert_equal 200, status
21142136
end
21152137

21162138
def test_resources_merges_options_from_scope

0 commit comments

Comments
 (0)