spec/unit/axiom/relation/header/rename_spec.rb in axiom-0.1.1 vs spec/unit/axiom/relation/header/rename_spec.rb in axiom-0.2.0
- old
+ new
@@ -4,16 +4,30 @@
describe Relation::Header, '#rename' do
subject { object.rename(aliases) }
let(:object) { described_class.coerce([[:id, Integer], [:name, String]], keys: keys) }
- let(:aliases) { Algebra::Rename::Aliases.coerce(object, id: :other_id) }
+ let(:aliases) { { id: :other_id } }
let(:keys) { Relation::Keys.new([described_class.coerce([[:id, Integer]])]) }
- it { should be_instance_of(described_class) }
+ context 'with aliases' do
+ let(:aliases) { Algebra::Rename::Aliases.coerce(object, super()) }
- it { should_not be(object) }
+ it { should be_instance_of(described_class) }
- its(:to_ary) { should == [[:other_id, Integer], [:name, String]] }
+ it { should_not be(object) }
- its(:keys) { should eql(Relation::Keys.new([described_class.coerce([[:other_id, Integer]])])) }
+ its(:to_ary) { should == [[:other_id, Integer], [:name, String]] }
+
+ its(:keys) { should eql(Relation::Keys.new([described_class.coerce([[:other_id, Integer]])])) }
+ end
+
+ context 'with a Hash' do
+ it { should be_instance_of(described_class) }
+
+ it { should_not be(object) }
+
+ its(:to_ary) { should == [[:other_id, Integer], [:name, String]] }
+
+ its(:keys) { should eql(Relation::Keys.new([described_class.coerce([[:other_id, Integer]])])) }
+ end
end