Sha256: 5874be745f8e26824a9655d12042aec5cbbb05775c0ef23f8b7e7938e1d5ea01

Contents?: true

Size: 1.42 KB

Versions: 10

Compression:

Stored size: 1.42 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

  context "commands" do
    it "serializes commands correctly" do
      command = Conglomerate::Command.new(
        :href => "http://this.is.a.command",
        :rel => "Something"
      )

      collection.commands << command
      expect(Conglomerate.serialize(collection)["commands"]).to include(Conglomerate.serialize(command))
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
conglomerate-0.16.0 spec/collection_spec.rb
conglomerate-0.15.0 spec/collection_spec.rb
conglomerate-0.14.0 spec/collection_spec.rb
conglomerate-0.13.0 spec/collection_spec.rb
conglomerate-0.12.1 spec/collection_spec.rb
conglomerate-0.12.0 spec/collection_spec.rb
conglomerate-0.11.1 spec/collection_spec.rb
conglomerate-0.11.0 spec/collection_spec.rb
conglomerate-0.10.0 spec/collection_spec.rb
conglomerate-0.9.0 spec/collection_spec.rb