Sha256: 2d14f11ee90a4fa6e7319aeb352ac54652e268ed3112ed8006d5ae6e882ea5d5

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

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