Sha256: 5af209070c758468850f82b23dfe870dd727fbab36b059aed2db4a67ca06abc3

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

require 'spec_helper'

module ApiNavigator
  describe Attributes do
    let(:representation) do
      JSON.parse(Fixtures::Requests.book_response)
    end

    let(:attributes) do
      Attributes.new(representation.fetch('data'))
    end

    it 'does not set _links as an attribute' do
      expect(attributes).not_to respond_to :_links
    end

    it 'does not set _meta as an attribute' do
      expect(attributes).not_to respond_to :_meta
    end

    it 'sets normal attributes' do
      expect(attributes).to respond_to :title
      expect(attributes.title).to be == "Book 1"

      expect(attributes).to respond_to :body
      expect(attributes.body).to be == 'Book 1 Body'

      expect(attributes).to respond_to :year
      expect(attributes.year).to be == 1999
    end

    it 'is a collection' do
      expect(Attributes.ancestors).to include(CollectionHash)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api_navigator-0.0.1 spec/lib/api_navigator/attribute_spec.rb