Sha256: 0430d1e5e6f6627e808155645602159cab6ac769b2d4bc1e9a5ceabcc0aee8eb
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Header, '#project' do subject { object.project(attributes) } let(:object) { described_class.coerce([ [ :id, Integer ], [ :name, String ] ], :keys => keys) } let(:keys) { Relation::Keys.new([ described_class.coerce([ [ :id, Integer ], [ :name, String ] ]) ]) } context 'with attribute objects' do let(:attributes) { [ attribute ] } let(:attribute) { Attribute::Integer.new(:id) } it { should be_instance_of(described_class) } it 'uses the attribute object' do subject[:id].should equal(attribute) end its(:to_ary) { should == [ [ :id, Integer ] ] } its(:keys) { should eql(Relation::Keys.new([ described_class.coerce([ [ :id, Integer ] ]) ])) } end context 'with Symbol attributes' do let(:attributes) { [ :id ] } it { should be_instance_of(described_class) } its(:to_ary) { should == [ [ :id, Integer ] ] } its(:keys) { should eql(Relation::Keys.new([ described_class.coerce([ [ :id, Integer ] ]) ])) } end context 'when the header has no keys' do let(:keys) { Relation::Keys.new } let(:attributes) { [ :id ] } it { should be_instance_of(described_class) } its(:to_ary) { should == [ [ :id, Integer ] ] } its(:keys) { should be_empty } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/relation/header/project_spec.rb |