Sha256: fc778a2de382eaf3aeeaf763856d4e342ceb6b33f55b15b996727e39f9751a78

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

describe "urls" do
  it "should define collection url" do
    MotionResource::Base.should.respond_to :collection_url
  end
  
  it "should define member url" do
    MotionResource::Base.should.respond_to :member_url
  end
  
  it "should define root url" do
    MotionResource::Base.should.respond_to :root_url
  end
  
  it "should define url extension" do
    MotionResource::Base.should.respond_to :extension
  end
  
  it "should default to json for extension" do
    MotionResource::Base.extension.should == '.json'
  end
  
  it "should define custom url method" do
    comment = Comment.new
    comment.should.respond_to :by_user_url
    comment.by_user_url.should.is_a String
  end
  
  it "should accept params in custom url method" do
    comment = Comment.new
    comment.should.respond_to :by_user_url
    comment.by_user_url(name: "john").should == "comments/by_user/john"
  end
  
  it "should define custom url singleton method" do
    Comment.should.respond_to :by_user_url
    Comment.by_user_url.should.is_a String
  end
  
  it "should define convenience collection_url method" do
    comment = Comment.new
    comment.should.respond_to :collection_url
    comment.collection_url.should.is_a String
    comment.collection_url.should == 'comments'
  end
  
  it "should define convenience member_url method" do
    comment = Comment.new
    comment.should.respond_to :member_url
    comment.member_url.should.is_a String
    comment.member_url(id: 10).should == 'comments/10'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
motion-resource-0.1.2 spec/motion-resource/urls_spec.rb
motion-resource-0.1.1 spec/motion-resource/urls_spec.rb
motion-resource-0.1.0 spec/motion-resource/urls_spec.rb
motion-resource-0.0.2 spec/motion-resource/urls_spec.rb
motion-resource-0.0.1 spec/motion-resource/urls_spec.rb