spec/resource_mockery_spec.rb in frenetic-1.0.0 vs spec/resource_mockery_spec.rb in frenetic-2.0.0

- old
+ new

@@ -9,10 +9,12 @@ let(:my_mocked_resource) do Class.new(my_temp_resource) do def self.default_attributes { + id: 1, + price: 0.0, qux: 'qux', _embedded: { embedded_resource: { plugh: 'xyzzy' } @@ -22,11 +24,13 @@ end end let(:params) do { - foo: 1, + id: '1', + foo: 'bar', + price: '0.0', bar: 'baz', _embedded: { embedded_resource: { grault: 'garply' }, @@ -50,19 +54,24 @@ describe '#properties' do subject { super().properties } it 'returns a hash of available properties' do - expect(subject).to include 'foo' => 'fixnum' + expect(subject).to include 'id' => 'fixnum' + expect(subject).to include 'price' => 'float' + expect(subject).to include 'foo' => 'string' + expect(subject).to include 'foo' => 'string' expect(subject).to include 'bar' => 'string' end end describe '#attributes' do subject { super().attributes } - it 'returns a hash of the resources attributes' do - expect(subject).to include 'foo' => 1 + it 'returns a hash of the resources type-casted attributes' do + expect(subject).to include 'id' => 1 + expect(subject).to include 'price' => 0.0 + expect(subject).to include 'foo' => 'bar' expect(subject).to include 'bar' => 'baz' expect(subject).to include 'qux' => 'qux' expect(subject['_embedded']['embedded_resource']).to include 'plugh' => 'xyzzy' expect(subject['_embedded']['embedded_resource']).to include 'grault' => 'garply' expect(subject['_embedded']['another_resource']).to include 'waldo' => 'fred'