Sha256: 5d6617acdbfa06a0e617fd392f0e298a631089190e525e21f36eb8195d6cc152

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require_relative "spec_helper"
require_relative "../lib/conglomerate"

describe Conglomerate::Collection do
  let(:collection) { Conglomerate::Collection.new }
  subject(:serialized_empty_collection) { Conglomerate.serialize(collection) }
  subject(:reference_empty_collection) {
    {
      "version" => "1.0"
    }
  }

  it "empty collection serializes properly" do
    expect(serialized_empty_collection).to eq(reference_empty_collection)
  end

  context "links" do
    it "serializes links correctly" do
      link = Conglomerate::Link.new(
        :href => "http://this.is.a.link",
        :rel => "Something"
      )

      collection.links << link
      expect(Conglomerate.serialize(collection)["links"]).to include(Conglomerate.serialize(link))
    end
  end

  context "queries" do
    it "serializes queries correctly" do
      query = Conglomerate::Query.new(
        :href => "http://this.is.a.query",
        :rel => "Something"
      )

      collection.queries << query
      expect(Conglomerate.serialize(collection)["queries"]).to include(Conglomerate.serialize(query))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conglomerate-0.8.1 spec/collection_spec.rb
conglomerate-0.8.0 spec/collection_spec.rb