test/json_representer_test.rb in roar-0.10.2 vs test/json_representer_test.rb in roar-0.11.0
- old
+ new
@@ -29,12 +29,12 @@
it "is aliased by #serialize" do
assert_equal '{"id":1}', @order.serialize
end
- it "accepts :include and :except" do
- assert_equal '{}', @order.to_json(:except => [:id])
+ it "accepts :include and :exclude" do
+ assert_equal '{}', @order.to_json(:exclude => [:id])
end
end
describe "#from_json" do
it "returns the deserialized model" do
@@ -53,12 +53,12 @@
it "works with an empty document" do
assert @order.from_json('')
end
- it "accepts :include and :except" do
- @order.from_json('{"id":1}', :except => [:id])
+ it "accepts :include and :exclude" do
+ @order.from_json('{"id":1}', :exclude => [:id])
assert_equal nil, @order.id
end
end
describe "JSON.from_json" do
@@ -116,13 +116,14 @@
it "responds to #links" do
assert_equal [], @r.links
end
it "extracts links from JSON" do
- @r = @c.from_json({:links => [{:rel => "self", :href => "http://self"}]}.to_json)
+ r = @c.from_json({:links => [{:rel => "self", :href => "http://self"}]}.to_json)
- assert_equal 1, @r.links.size
- assert_equal(["self", "http://self"], [@r.links.first.rel, @r.links.first.href])
+ assert_equal 1, r.links.size
+ link = r.links.first
+ assert_equal(["self", "http://self"], [link.rel, link.href])
end
it "renders link: correctly in JSON" do
assert_equal "{\"id\":1,\"links\":[{\"rel\":\"self\",\"href\":\"http://self\"},{\"rel\":\"next\",\"href\":\"http://next/1\"}]}", @c.new(:id => 1).to_json
end