spec/lib/contentful/management/entry_spec.rb in contentful-management-0.7.2 vs spec/lib/contentful/management/entry_spec.rb in contentful-management-0.7.3

- old
+ new

@@ -343,10 +343,19 @@ publish = entry.publish expect(publish).to be_a RateLimitExceeded expect(publish.error[:message]).to eq 'You have exceeded the rate limit of the Organization this Space belongs to by making too many API requests within a short timespan. Please wait a moment before trying the request again.' end end + + it 'with just an id' do + vcr('entry/create_with_just_id') do + space = Contentful::Management::Space.find('bbukbffokvih') + entry = space.content_types.all.first.entries.create({'id' => 'yol'}) + entry.save + expect(entry).to be_a Contentful::Management::Entry + end + end end describe '#update' do let(:entry_id) { '1I3qWOiP8k2WWYCogKy88S' } it 'update entry' do @@ -708,8 +717,27 @@ expect(parsed_attributes[:entries]).to match('en-US' => [{sys: {type: 'Link', linkType: 'Entry', id: nil}}, {sys: {type: 'Link', linkType: 'Entry', id: nil}}]) end end + describe 'issues' do + describe 'handles multiple locales even when they are not all defined for the default locale - #70' do + it 'merges all present locales' do + vcr('entry/issue_70') { + space = Contentful::Management::Space.find('9sh5dtmfyzhj') + + entry_non_default_locale = space.entries.find('1PdCkb5maYgqsSUCOweseM') + + expect(entry_non_default_locale.name_with_locales).to match({"de-DE" => nil, "es" => "Futbolista"}) + expect(entry_non_default_locale.non_localized_with_locales).to match({"de-DE" => "baz", "es" => nil}) + + entry_with_all_locales = space.entries.find('1QKkNRf9AEW2wqwWowgscs') + + expect(entry_with_all_locales.name_with_locales).to match({"de-DE" => "Junge", "en-US" => "Boy", "es" => "Chico"}) + expect(entry_with_all_locales.non_localized_with_locales).to match({"de-DE" => "foobar", "en-US" => nil, "es" => nil}) + } + end + end + end end end end