Sha256: de838eb4c2debab264875abf204d8c576012b17d5a478b2771b7f2eb84dba32d
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 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 be(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.1 | spec/unit/axiom/relation/header/project_spec.rb |