Sha256: 9b1790e9b62c2099b464a6f4f76d6f03191f30b3d60cd85a06eb2dd2aa80354c
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Algebra::Rename::Aliases, '.coerce' do subject { object.coerce(attributes, aliases) } let(:attribute) { Attribute::Integer.new(:id) } let(:attributes) { Relation::Header.new([ attribute ]) } let(:object) { described_class } context 'the aliases are an Alias object' do let(:old_attr) { attribute } let(:new_attr) { attribute.rename(:other_id) } let(:aliases) { object.new(old_attr => new_attr) } it { should equal(aliases) } end context 'the old and new attributes are Symbols' do let(:old_attr) { :id } let(:new_attr) { :other_id } let(:aliases) { { old_attr => new_attr } } it { should be_kind_of(object) } it { should == { attribute => attribute.rename(:other_id) } } end context 'the old attribute is a Symbol, and the new attribute is an Attribute' do let(:old_attr) { :id } let(:new_attr) { attribute.rename(:other_id) } let(:aliases) { { old_attr => new_attr } } it { should be_kind_of(object) } it { should == { attribute => attribute.rename(:other_id) } } end context 'the old attribute is an Attribute, and the new attribute is a Symbol' do let(:old_attr) { attribute } let(:new_attr) { :other_id } let(:aliases) { { old_attr => new_attr } } it { should be_kind_of(object) } it { should == { attribute => attribute.rename(:other_id) } } end context 'the old and new attributes are Attributes' do let(:old_attr) { attribute } let(:new_attr) { attribute.rename(:other_id) } let(:aliases) { { old_attr => new_attr } } it { should be_kind_of(object) } it { should == { attribute => attribute.rename(:other_id) } } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.4 | spec/unit/veritas/algebra/rename/aliases/class_methods/coerce_spec.rb |