spec/unit/axiom/relation/header/union_spec.rb in axiom-0.1.0 vs spec/unit/axiom/relation/header/union_spec.rb in axiom-0.1.1

- old
+ new

@@ -1,20 +1,20 @@ # encoding: utf-8 require 'spec_helper' -[ :union, :| ].each do |method| +[:union, :|].each do |method| describe Relation::Header, "##{method}" do subject { object.send(method, other) } let(:object) { described_class.coerce(attributes, options) } let(:other) { described_class.coerce(other_attributes, other_options) } - let(:attributes) { [ [ :id, Integer ], [ :name, String ] ] } + let(:attributes) { [[:id, Integer], [:name, String]] } let(:other_attributes) { attributes } let(:options) { {} } let(:other_options) { options } - let(:keys) { Relation::Keys.coerce([ [ [ :id, Integer ] ] ]) } + let(:keys) { Relation::Keys.coerce([[[:id, Integer]]]) } let(:other_keys) { keys } context 'when the attributes are equivalent' do it { should be_instance_of(described_class) } @@ -22,65 +22,65 @@ its(:keys) { should be_empty } end context 'when the attributes intersect' do - let(:other_attributes) { [ [ :id, Integer ] ] } + let(:other_attributes) { [[:id, Integer]] } it { should be_instance_of(described_class) } - its(:to_ary) { should == [ [ :id, Integer ], [ :name, String ] ] } + its(:to_ary) { should == [[:id, Integer], [:name, String]] } its(:keys) { should be_empty } end context 'when the attributes do not intersect' do - let(:other_attributes) { [ [ :age, Integer ] ] } + let(:other_attributes) { [[:age, Integer]] } it { should be_instance_of(described_class) } - its(:to_ary) { should == [ [ :id, Integer ], [ :name, String ], [ :age, Integer ] ] } + its(:to_ary) { should == [[:id, Integer], [:name, String], [:age, Integer]] } its(:keys) { should be_empty } end context 'when the keys are equivalent' do - let(:other_attributes) { [ [ :id, Integer ], [ :name, String ], [ :age, Integer ] ] } - let(:options) { { :keys => keys } } + let(:other_attributes) { [[:id, Integer], [:name, String], [:age, Integer]] } + let(:options) { { keys: keys } } it { should be_instance_of(described_class) } its(:to_ary) { should == other_attributes } its(:keys) { should eql(keys) } end context 'when the keys intersect' do - let(:other_attributes) { [ [ :id, Integer ], [ :name, String ], [ :age, Integer ] ] } - let(:options) { { :keys => keys } } - let(:other_options) { { :keys => other_keys } } + let(:other_attributes) { [[:id, Integer], [:name, String], [:age, Integer]] } + let(:options) { { keys: keys } } + let(:other_options) { { keys: other_keys } } let(:other_keys) do Relation::Keys.coerce([ - [ [ :id, Integer ] ], - [ [ :age, Integer ] ], - ]) + [[:id, Integer]], + [[:age, Integer]], + ]) end it { should be_instance_of(described_class) } its(:to_ary) { should == other_attributes } - its(:keys) { should == [ [ [ :id, Integer ] ] ] } + its(:keys) { should == [[[:id, Integer]]] } end context 'when the keys do not intersect' do - let(:other_attributes) { [ [ :id, Integer ], [ :name, String ], [ :age, Integer ] ] } - let(:options) { { :keys => keys } } - let(:other_options) { { :keys => other_keys } } + let(:other_attributes) { [[:id, Integer], [:name, String], [:age, Integer]] } + let(:options) { { keys: keys } } + let(:other_options) { { keys: other_keys } } let(:other_keys) do - Relation::Keys.coerce([ [ [ :name, String ], [ :age, Integer ] ] ]) + Relation::Keys.coerce([[[:name, String], [:age, Integer]]]) end it { should be_instance_of(described_class) } its(:to_ary) { should == other_attributes }