Sha256: 1f812816aef60a3f32eb29797b3dd1bcdfb7326362d723e52e6f0194cecb60dd

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Header, '#extend' do
  subject { object.extend(attributes) }

  let(:object) { described_class.coerce([ [ :id, Integer ] ], :keys => keys) }
  let(:keys)   { Relation::Keys.new([ described_class.new ])                 }

  context 'with attribute objects' do
    let(:attributes) { [ attribute ]                }
    let(:attribute)  { Attribute::String.new(:name) }

    it { should be_instance_of(described_class) }

    it 'uses the attribute object' do
      subject[:name].should equal(attribute)
    end

    its(:to_ary) { should == [ [ :id, Integer ], [ :name, String ] ] }

    its(:keys) { should equal(keys) }
  end

  context 'with Symbol attributes' do
    let(:attributes) { [ :name ] }

    it { should be_instance_of(described_class) }

    its(:to_ary) { should == [ [ :id, Integer ], [ :name, Object ] ] }

    its(:keys) { should equal(keys) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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