spec/lib/contentful/management/entry_spec.rb in contentful-management-0.3.1 vs spec/lib/contentful/management/entry_spec.rb in contentful-management-0.4.0

- old
+ new

@@ -53,10 +53,18 @@ vcr('entry/find_not_found') do result = subject.find(space_id, 'not_exist') expect(result).to be_kind_of Contentful::Management::NotFound end end + context 'raise_error when space not found' do + let!(:client) { Client.new(token, raise_errors: true) } + it 'returns an error when entry does not exists' do + expect_vcr('entry/find_not_found') do + subject.find(space_id, 'not_exist') + end.to raise_error Contentful::Management::NotFound + end + end 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 @@ -266,13 +274,13 @@ it 'with entries' do vcr('entry/create_with_entries') do entry_att = Entry.find(space_id, '1d1QDYzeiyWmgqQYysae8u') new_entry = subject.create(content_type, - name: 'EntryWithEntries', - age: 20, - entries: [entry_att, entry_att, entry_att]) + name: 'EntryWithEntries', + age: 20, + entries: [entry_att, entry_att, entry_att]) expect(new_entry.name).to eq 'EntryWithEntries' expect(new_entry.age).to eq 20 end end @@ -570,22 +578,22 @@ end # file = Asset.find('ene4qtp2sh7u', '2oNoT3vSAs82SOIQmKe0KG') # entry_att = Entry.find('ene4qtp2sh7u', '60zYC7nY9GcKGiCYwAs4wm') attributes = { - name: 'Test name', - number: 30, - float1: 1.1, - boolean: true, date: '2000-07-12T11:11:00+02:00', - time: '2000-07-12T11:11:00+02:00', - location: location, - image: Asset.new, - images: [Asset.new, Asset.new], - array: %w(PL USD XX), - entry: Entry.new, - entries: [Entry.new, Entry.new], - object_json: {'test' => {'@type' => 'Codequest'}} + name: 'Test name', + number: 30, + float1: 1.1, + boolean: true, date: '2000-07-12T11:11:00+02:00', + time: '2000-07-12T11:11:00+02:00', + location: location, + image: Asset.new, + images: [Asset.new, Asset.new], + array: %w(PL USD XX), + entry: Entry.new, + entries: [Entry.new, Entry.new], + object_json: {'test' => {'@type' => 'Codequest'}} } parsed_attributes = Entry.new.fields_from_attributes(attributes) expect(parsed_attributes[:name]).to match('en-US' => 'Test name') @@ -604,10 +612,10 @@ end it 'keepd hashes in attributes' do attributes = { - entries: [{sys: {type: 'Link', linkType: 'Entry', id: nil}}, {sys: {type: 'Link', linkType: 'Entry', id: nil}}] + entries: [{sys: {type: 'Link', linkType: 'Entry', id: nil}}, {sys: {type: 'Link', linkType: 'Entry', id: nil}}] } parsed_attributes = Entry.new.fields_from_attributes(attributes) expect(parsed_attributes[:entries]).to match('en-US' => [{sys: {type: 'Link', linkType: 'Entry', id: nil}}, {sys: {type: 'Link', linkType: 'Entry', id: nil}}])