Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 0f3106ee47
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (33 sloc) 0.986 kb
require 'test_helper'
class RepresenterTest < MiniTest::Spec
describe "Representer" do
before do
@c = Class.new do
include Roar::Representer
end
end
it "aliases #representable_property to #property" do
@c.property :title
assert_equal "title", @c.representable_attrs.first.name
end
it "aliases #representable_collection to #collection" do
@c.collection :songs
assert_equal "songs", @c.representable_attrs.first.name
end
end
describe "Inheritance" do
it "properly inherits properties from modules" do
module PersonRepresentation
include Roar::Representer::JSON
property :name
end
class Person
include AttributesContructor
include Roar::Representer::JSON
include PersonRepresentation
attr_accessor :name
end
assert_equal "{\"name\":\"Paulo\"}", Person.new(:name => "Paulo").to_json
end
end
end
Jump to Line
Something went wrong with that request. Please try again.