Sha256: c5127bbaa811790ced60a27fc30ebc33352130d503de55593e586ee247d409fc

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
roar-0.12.0 test/client_test.rb
roar-0.11.19 test/client_test.rb
roar-0.11.18 test/client_test.rb
roar-0.11.17 test/client_test.rb
roar-0.11.16 test/client_test.rb
roar-0.11.15 test/client_test.rb
roar-0.11.14 test/client_test.rb
roar-0.11.13 test/client_test.rb
roar-0.11.12 test/client_test.rb
roar-0.11.11 test/client_test.rb
roar-0.11.10 test/client_test.rb
roar-0.11.9 test/client_test.rb