Sha256: bdd2acfbb676189bb4eda41c371420ce2b391fd1ec7bfefd0b272e1e341f26c5

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 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 be(attribute)
    end

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

    its(:keys) { should be(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 be(keys) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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