提交 075f50d6 编写于 作者: J Joshua Peek

Fix some nested resource generation tests

上级 f69f9820
......@@ -80,15 +80,19 @@ def resource(*resources, &block)
resource = SingletonResource.new(resources.pop, :name_prefix => name_prefix)
if @scope[:scope_level] == :resources
member do
resource(resource.name, options, &block)
parent_resource = @scope[:scope_level_options][:name]
parent_named_prefix = @scope[:scope_level_options][:name_prefix]
with_scope_level(:member) do
scope(":#{parent_resource}_id", :name_prefix => parent_named_prefix) do
resource(resource.name, options, &block)
end
end
return self
end
controller(resource.controller) do
namespace(resource.name) do
with_scope_level(:resource, :name => resource.singular) do
with_scope_level(:resource, :name => resource.singular, :name_prefix => resource.member_name) do
yield if block_given?
get "", :to => :show, :as => resource.member_name
......@@ -118,8 +122,9 @@ def resources(*resources, &block)
if @scope[:scope_level] == :resources
parent_resource = @scope[:scope_level_options][:name]
parent_named_prefix = @scope[:scope_level_options][:name_prefix]
with_scope_level(:member) do
scope(":#{parent_resource}_id", :name_prefix => parent_resource) do
scope(":#{parent_resource}_id", :name_prefix => parent_named_prefix) do
resources(resource.name, options, &block)
end
end
......@@ -128,7 +133,7 @@ def resources(*resources, &block)
controller(resource.controller) do
namespace(resource.name) do
with_scope_level(:resources, :name => resource.singular) do
with_scope_level(:resources, :name => resource.singular, :name_prefix => resource.member_name) do
yield if block_given?
collection do
......
......@@ -251,9 +251,7 @@ def test_projects_companies
get '/projects/1/companies/1/people'
assert_equal 'people#index', @response.body
pending do
assert_equal '/projects/1/companies/1/people', project_company_people_path(:project_id => '1', :company_id => '1')
end
assert_equal '/projects/1/companies/1/people', project_company_people_path(:project_id => '1', :company_id => '1')
get '/projects/1/companies/1/avatar'
assert_equal 'avatars#show', @response.body
......@@ -345,9 +343,7 @@ def test_projects_posts
get '/projects/1/posts/1/comments'
assert_equal 'comments#index', @response.body
pending do
assert_equal '/projects/1/posts/1/comments', project_post_comments_path(:project_id => '1', :post_id => '1')
end
assert_equal '/projects/1/posts/1/comments', project_post_comments_path(:project_id => '1', :post_id => '1')
post '/projects/1/posts/1/comments/preview'
assert_equal 'comments#preview', @response.body
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册