Sha256: 5e5b20b493baeb7723f3539b79823cfbc22b384768e225f9391784e0db921d1b

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

[ :call, :[] ].each do |method|
  describe Relation::Header, "##{method}" do
    subject { object.send(method, name) }

    let(:object)    { described_class.coerce([ attribute ]) }
    let(:attribute) { Attribute::Integer.new(:id)           }

    context 'with a known attribute' do
      let(:name) { attribute }

      it { should == [ :id, Integer ] }
    end

    context 'with a known attribute name' do
      let(:name) { :id }

      it { should == [ :id, Integer ] }
    end

    context 'with an unknown attribute' do
      let(:name) { Attribute::String.new(:name) }

      specify { expect { subject }.to raise_error(UnknownAttributeError, 'the attribute name is unknown') }
    end

    context 'with an unknown attribute name' do
      let(:name) { :name }

      specify { expect { subject }.to raise_error(UnknownAttributeError, 'the attribute name is unknown') }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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