spec/lib/contentful/management/entry_spec.rb in contentful-management-1.9.0 vs spec/lib/contentful/management/entry_spec.rb in contentful-management-1.10.0

- old
+ new

@@ -120,21 +120,29 @@ it 'returns an error when service is unavailable' do vcr('entry/service_unavailable') do result = subject.find(space_id, 'not_exist') expect(result).to be_kind_of Contentful::Management::ServiceUnavailable - expect(result.message).to eq 'Service Unavailable, contentful.com API seems to be down' + message = [ + "HTTP status code: 503 Service Unavailable", + "Message: Service unavailable." + ].join("\n") + expect(result.message).to eq message end end end describe '#destroy' do it 'returns Contentful::BadRequest error when content type is published' do vcr('entry/destory_published') do result = subject.find(space_id, '3U7JqGuVzOWIimU40mKeem').destroy expect(result).to be_kind_of Contentful::Management::BadRequest - expect(result.message).to eq 'Cannot deleted published' + message = [ + "HTTP status code: 400 Bad Request", + "Message: Cannot deleted published" + ].join("\n") + expect(result.message).to eq message end end it 'returns true when entry is not published' do vcr('entry/destroy') do result = subject.find(space_id, '3U7JqGuVzOWIimU40mKeem').destroy @@ -156,11 +164,15 @@ it 'returns BadRequest error when already unpublished' do vcr('entry/unpublish_already_unpublished') do result = subject.find(space_id, entry_id).unpublish expect(result).to be_kind_of Contentful::Management::BadRequest - expect(result.message).to eq 'Not published' + message = [ + "HTTP status code: 400 Bad Request", + "Message: Not published" + ].join("\n") + expect(result.message).to eq message expect(result.error[:message]).to eq 'Not published' expect(result.error[:url]).to eq 'spaces/yr5m0jky5hsh/entries/4Rouux8SoUCKwkyCq2I0E0/published' expect(result.error[:details]).to eq "{\n \"sys\": {\n \"type\": \"Error\",\n \"id\": \"BadRequest\"\n },\n \"message\": \"Not published\"\n}\n" end end @@ -222,11 +234,15 @@ it 'returns BadRequest error when already unarchived' do vcr('entry/unarchive_already_unarchived') do result = subject.find(space_id, entry_id).unarchive expect(result).to be_kind_of Contentful::Management::BadRequest - expect(result.message).to eql 'Not archived' + message = [ + "HTTP status code: 400 Bad Request", + "Message: Not archived" + ].join("\n") + expect(result.message).to eq message end end end describe '#archive' do @@ -241,10 +257,14 @@ end it 'returns error when archive published entry' do vcr('entry/archive_published') do entry = subject.find(space_id, entry_id).archive expect(entry).to be_kind_of Contentful::Management::BadRequest - expect(entry.message).to eql 'Cannot archive published' + message = [ + "HTTP status code: 400 Bad Request", + "Message: Cannot archive published" + ].join("\n") + expect(entry.message).to eq message end end end describe '#archived?' do