Sha256: aea956cadfe4c954ea23cfdfb0bbffa5f4127953ed7e4ba5d98087d460e2baab

Contents?: true

Size: 704 Bytes

Versions: 14

Compression:

Stored size: 704 Bytes

Contents

require "spec_helper"

describe Shamu::JsonApi::RelationshipBuilder do
  let( :context ) { Shamu::JsonApi::Context.new }
  let( :builder ) { Shamu::JsonApi::RelationshipBuilder.new( context ) }

  before( :each ) do
    builder.identifier "example", 1
  end

  describe "#compile" do
    it "fails if identifier has not been specified" do
      expect do
        Shamu::JsonApi::RelationshipBuilder.new( context ).compile
      end.to raise_error Shamu::JsonApi::IncompleteResourceError
    end
  end

  describe "#identifier" do
    it "writes type and id" do
      builder.identifier "spec", 5

      expect( builder.compile ).to include data: hash_including( type: "spec", id: "5" )
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shamu-0.0.24 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.21 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.20 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.19 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.18 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.17 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.15 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.14 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.13 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.11 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.9 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.8 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.7 spec/lib/shamu/json_api/relationship_builder_spec.rb
shamu-0.0.5 spec/lib/shamu/json_api/relationship_builder_spec.rb