Sha256: 32f741efc589168cb0dfc4221a0f20ac07e78cb0cba32ad363bbcb3a2221c8f7
Contents?: true
Size: 981 Bytes
Versions: 7
Compression:
Stored size: 981 Bytes
Contents
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
Version data entries
7 entries across 7 versions & 1 rubygems