Sha256: c0eef6ec37d24154cd8b198471b288935c218012b279786ac3cfcb47fc9d1d50
Contents?: true
Size: 775 Bytes
Versions: 2
Compression:
Stored size: 775 Bytes
Contents
class DelegateObject attr_accessor :id, :name end describe "String" do it "should fill url params from params hash" do string = "accounts/:id/users/:name".fill_url_params(id: 10, name: 'john') string.should == "accounts/10/users/john" end it "should fill url params from delegate object" do obj = DelegateObject.new obj.id = 10 obj.name = 'john' string = "accounts/:id/users/:name".fill_url_params({}, obj) string.should == "accounts/10/users/john" end it "should not crash when a param is unknown" do lambda { "accounts/:id".fill_url_params({}) }.should.not.raise end it "should not crash when params hash contains an unused value" do lambda { "accounts".fill_url_params(foo: 'bar') }.should.not.raise end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motion-resource-0.0.2 | spec/motion-resource/string_spec.rb |
motion-resource-0.0.1 | spec/motion-resource/string_spec.rb |