spec/acfs/resource/attributes/dict_spec.rb in acfs-1.7.0 vs spec/acfs/resource/attributes/dict_spec.rb in acfs-2.0.0

- old
+ new

@@ -4,40 +4,40 @@ describe Acfs::Resource::Attributes::Dict do let(:type) { Acfs::Resource::Attributes::Dict.new } describe '#cast' do - subject(:cast) { -> { type.cast value } } + subject(:cast) { type.cast value } context 'with nil' do let(:value) { nil } - it { expect(cast.call).to eq nil } + it { expect(cast).to be_nil } end context 'with blank string (I)' do let(:value) { '' } - it { expect(cast.call).to eq({}) } + it { expect(cast).to eq({}) } end context 'with blank string (II)' do let(:value) { " \t" } - it { expect(cast.call).to eq({}) } + it { expect(cast).to eq({}) } end context 'with hash' do let(:value) { {3 => true, abc: 4} } - it { expect(cast.call).to eq value } + it { expect(cast).to eq value } end context 'with non hashable object' do let(:value) { Object.new } - it { is_expected.to raise_error TypeError } + it { expect { cast }.to raise_error TypeError } end context 'with hashable object (I)' do let(:value) do Class.new do @@ -45,11 +45,11 @@ {id: object_id} end end.new end - it { expect(cast.call).to eq id: value.object_id } + it { expect(cast).to eq id: value.object_id } end context 'with hashable object (II)' do let(:value) do Class.new do @@ -57,11 +57,11 @@ {id: object_id} end end.new end - it { expect(cast.call).to eq id: value.object_id } + it { expect(cast).to eq id: value.object_id } end context 'with serializable object' do let(:value) do Class.new do @@ -69,15 +69,15 @@ {id: object_id} end end.new end - it { expect(cast.call).to eq id: value.object_id } + it { expect(cast).to eq id: value.object_id } end context 'with hash subclass object' do let(:value) { HashWithIndifferentAccess.new test: :foo } - it { expect(cast.call).to be value } + it { expect(cast).to be value } end end end