Sha256: 4184efecf606ce1778c8183a4132c94c79ec0921dbb31595aafc23b4192daf97

Contents?: true

Size: 664 Bytes

Versions: 7

Compression:

Stored size: 664 Bytes

Contents

require 'ostruct'
require 'test_helper'
require 'roar/json/hal'


class HalLinkTest < MiniTest::Spec
  let(:rpr) do
    Module.new do
      include Roar::JSON
      include Roar::JSON::HAL::Links
      link :self do
        "//songs"
      end
    end
  end

  subject { Object.new.extend(rpr) }

  describe "#to_json" do
    it "uses 'links' key" do
      subject.to_json.must_equal "{\"links\":{\"self\":{\"href\":\"//songs\"}}}"
    end
  end

  describe "#from_json" do
    it "uses 'links' key" do
      subject.from_json("{\"links\":{\"self\":{\"href\":\"//lifer\"}}}").links.values.must_equal [link("href" => "//lifer", "rel" => "self")]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roar-1.0.4 test/hal_links_test.rb
roar-1.0.3 test/hal_links_test.rb
roar-1.0.2 test/hal_links_test.rb
roar-1.0.1 test/hal_links_test.rb
roar-1.0.0 test/hal_links_test.rb
roar-1.0.0.beta2 test/hal_links_test.rb
roar-1.0.0.beta1 test/hal_links_test.rb