Sha256: 3b987c86f189741bc1628ec75f51398aecdc21320ec4030977ba1186c46ea5ce

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Header, '#keys' do
  subject { object.keys }

  let(:attributes) { [ [ :id, Integer ], [ :name, String ] ] }
  let(:keys_class) { Relation::Keys                          }

  context 'with explicit keys' do
    let(:object) { described_class.coerce(attributes, :keys => keys) }
    let(:keys)   { [ [ :id ] ]                                       }

    it { should be_instance_of(keys_class) }

    it 'has a set of keys' do
      should == keys_class.new([ described_class.new([ object[:id] ]) ])
    end

    it { should be_frozen }
  end

  context 'with no explicit keys' do
    let(:object) { described_class.coerce(attributes) }

    it { should be_instance_of(keys_class) }

    it 'has an empty set of keys' do
      should be_empty
    end

    it { should be_frozen }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/relation/header/keys_spec.rb