spec/praxis/response_definition_spec.rb in praxis-2.0.pre.4 vs spec/praxis/response_definition_spec.rb in praxis-2.0.pre.5
- old
+ new
@@ -512,16 +512,15 @@
response.headers(headers) if headers
end
context 'for a definition with a media type' do
let(:media_type) { Instance }
- subject(:payload) { output[:payload] }
+ subject(:payload) { output[:payload][:type] }
before do
response.media_type Instance
end
-
its([:name]) { should eq 'Instance' }
context 'examples' do
subject(:examples) { payload[:examples] }
its(['json', :content_type]) { should eq('application/vnd.acme.instance+json') }
its(['xml', :content_type]) { should eq('application/vnd.acme.instance+xml') }
@@ -569,11 +568,13 @@
it 'should contain a parts_like key with a hash' do
expect( output ).to have_key(:parts_like)
end
it{ should be_kind_of(::Hash) }
- its([:payload]){ should == {id: 'Praxis-SimpleMediaType', name: 'Praxis::SimpleMediaType', family: 'string', identifier: 'foobar' } }
+ it 'has the right type info' do
+ expect(subject[:payload][:type]).to match(id: 'Praxis-SimpleMediaType', name: 'Praxis::SimpleMediaType', family: 'string', identifier: 'foobar')
+ end
its([:status]){ should == 200 }
end
context 'using a full response definition block' do
let(:parts_block) do
Proc.new do
@@ -585,10 +586,12 @@
it 'should contain a parts_like key with a hash' do
expect( output ).to have_key(:parts_like)
end
it{ should be_kind_of(::Hash) }
- its([:payload]) { should == {id: 'Praxis-SimpleMediaType', name: 'Praxis::SimpleMediaType', family: 'string', identifier: 'custom_media'} }
+ it 'has the right type info' do
+ expect(subject[:payload][:type]).to match(id: 'Praxis-SimpleMediaType', name: 'Praxis::SimpleMediaType', family: 'string', identifier: 'custom_media')
+ end
its([:status]) { should == 234 }
end
end
end
end