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

- old
+ new

@@ -2,52 +2,52 @@ require 'spec_helper' describe Relation::Header, '.coerce' do let(:object) { described_class } - let(:header) { object.new([ attribute ]) } + let(:header) { object.new([attribute]) } let(:attribute) { Attribute::Integer.new(:id) } - let(:array) { [ [ :id, Integer ] ] } + let(:array) { [[:id, Integer]] } context 'with a block' do subject { object.coerce(argument, &block) } context 'when the argument is a Header' do let(:argument) { header } let(:block) { proc { raise 'should not raise' } } - it { should equal(header) } + it { should be(header) } end context 'when the argument responds to #to_ary' do let(:argument) { array } context 'and the block returns another attribute' do - let(:block) { lambda { |attribute| other } } - let(:other) { Attribute::Object.new(:id) } + let(:block) { ->(attribute) { other } } + let(:other) { Attribute::Object.new(:id) } it { should be_instance_of(object) } - it { should eql(object.new([ other ])) } + it { should eql(object.new([other])) } its(:keys) { should be_empty } end context 'and the block does not match another attribute' do - let(:block) { lambda { |attribute| nil } } + let(:block) { ->(attribute) { nil } } it { should be_instance_of(object) } it { should eql(header) } its(:keys) { should be_empty } end end context 'when the argument is not a Header and does not respond to #to_ary' do - let(:argument) { Object.new } - let(:block) { lambda { |attribute| nil } } + let(:argument) { Object.new } + let(:block) { ->(attribute) { nil } } specify { expect { subject }.to raise_error(NoMethodError) } end end @@ -55,11 +55,11 @@ subject { object.coerce(argument) } context 'when the argument is a Header' do let(:argument) { header } - it { should equal(header) } + it { should be(header) } end context 'when the argument responds to #to_ary' do let(:argument) { array } @@ -80,22 +80,22 @@ context 'with an attribute' do subject { object.coerce(attribute) } it { should be_instance_of(object) } - its(:to_a) { should == [ attribute ] } + its(:to_a) { should == [attribute] } its(:keys) { should be_empty } end context 'with options' do subject { object.coerce(array, options) } - let(:options) { { :keys => [ array ] } } + let(:options) { { keys: [array] } } it { should be_instance_of(object) } its(:to_a) { should == array } - its(:keys) { should == [ array ] } + its(:keys) { should == [array] } end end