spec/unit/pacto/response_clause_spec.rb in pacto-0.3.1 vs spec/unit/pacto/response_clause_spec.rb in pacto-0.4.0.rc1

- old
+ new

@@ -1,26 +1,23 @@ +# -*- encoding : utf-8 -*- module Pacto describe ResponseClause do let(:body_definition) do - { - :type => 'object', - :required => true, - :properties => double('body definition properties') - } + Fabricate(:schema) end let(:definition) do { 'status' => 200, 'headers' => { 'Content-Type' => 'application/json' }, - 'body' => body_definition + 'schema' => body_definition } end - subject(:response) { ResponseClause.new(definition) } + subject(:response) { described_class.new(definition) } it 'has a status' do expect(response.status).to eq(200) end @@ -33,22 +30,12 @@ it 'has a schema' do expect(response.schema).to eq(body_definition) end it 'has a default value for the schema' do - response = ResponseClause.new(definition.merge('body' => nil)) + definition.delete 'schema' + response = described_class.new(definition) expect(response.schema).to eq(Hash.new) end - describe 'the response body' do - let(:generated_body) { double } - - it 'is the json generated from the schema' do - JSON::Generator.should_receive(:generate). - with(definition['body']). - and_return(generated_body) - - expect(response.body).to eq(generated_body) - end - end end end