Sha256: f9c8abe208262b44f83e8745829b92807a499c16ef3eb02d77e589a911488a11
Contents?: true
Size: 982 Bytes
Versions: 9
Compression:
Stored size: 982 Bytes
Contents
require 'test_helper' require 'roar/representer/feature/client' class ClientTest < MiniTest::Spec representer_for([Roar::Representer]) do property :name property :band end let(:song) { Object.new.extend(rpr).extend(Roar::Representer::Feature::Client) } it "adds accessors" do song.name = "Social Suicide" song.band = "Bad Religion" assert_equal "Social Suicide", song.name assert_equal "Bad Religion", song.band end describe "links" do representer_for([Roar::Representer::JSON, Roar::Representer::Feature::Hypermedia]) do property :name link(:self) { never_call_me! } end it "suppresses rendering" do song.name = "Silenced" song.to_json.must_equal %{{\"name\":\"Silenced\",\"links\":[]}} end # since this is considered dangerous, we test the mutuable options. it "adds links: false to options" do song.to_hash(options = {}) options.must_equal({:links => false}) end end end
Version data entries
9 entries across 9 versions & 1 rubygems