Skip to content
Browse files

added failing spec

  • Loading branch information...
1 parent f5741be commit ba4b9595f57e1e16c022a150bab6468aa7f6a976 @nakajima committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 spec/resource_spec.rb
View
14 spec/resource_spec.rb
@@ -52,5 +52,19 @@
@resource.path('/:id', @comment).should == "/articles/#{@article.to_param}/comments/#{@comment.to_param}"
end
end
+
+ context "when maker has multiple parents" do
+ before(:each) do
+ build_model(:replies) { integer :comment_id; belongs_to :comment }
+ @reply = Reply.create! :comment => @comment
+ @child = new_maker(Comment, :parent => new_maker(Article))
+ @grand_child = new_maker(Reply, :parent => @child)
+ @resource = Sinatra::Hat::Resource.new(@grand_child)
+ end
+
+ it "can return path for model object" do
+ @resource.path('/:id', @reply).should == "/articles/#{@article.to_param}/comments/#{@comment.to_param}/replies/#{@reply.to_param}"
+ end
+ end
end
end

0 comments on commit ba4b959

Please sign in to comment.
Something went wrong with that request. Please try again.