contentful-management 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,9 +40,19 @@ module Contentful
40
40
  end
41
41
 
42
42
  describe '#find' do
43
+ it 'returns null as nil on empty Symbols' do
44
+ vcr('entry/find-with-null-symbols') do
45
+ space = Contentful::Management::Space.find space_id
46
+ entry = space.entries.find(entry_id)
47
+ expect(entry.fields[:videoid]).to_not be_kind_of(String)
48
+ expect(entry.fields[:videoid]).to be_nil
49
+ end
50
+ end
51
+
43
52
  it 'returns a Contentful::Management::Entry' do
44
53
  vcr('entry/find') { expect(subject.find(space_id, entry_id)).to be_kind_of Contentful::Management::Entry }
45
54
  end
55
+
46
56
  it 'returns the entry for a given key' do
47
57
  vcr('entry/find') do
48
58
  entry = subject.find(space_id, entry_id)
@@ -393,6 +403,22 @@ module Contentful
393
403
  expect(result).to be_kind_of Contentful::Management::Error
394
404
  end
395
405
  end
406
+
407
+ it 'can update boolean fields to `false`' do
408
+ vcr('entry/update_bool_field') do
409
+ space = Contentful::Management::Space.find('fujuvqn6zcl1')
410
+ content_type = space.content_types.find('1kUEViTN4EmGiEaaeC6ouY')
411
+
412
+ q = content_type.entries.new
413
+ q.name_with_locales = {'en-US' => 'Hello World'}
414
+ q.yolo_with_locales = {'en-US' => false}
415
+ expected = q.fields
416
+ q.save
417
+
418
+ p = space.entries.find(q.id)
419
+ expect(p.fields).to match(expected)
420
+ end
421
+ end
396
422
  end
397
423
 
398
424
  describe '#save' do
@@ -606,6 +632,29 @@ module Contentful
606
632
  expect(entry.fields[:yolo]).to eq 'YOLO'
607
633
  end
608
634
  end
635
+
636
+ it 'sets value for the default locale when using simple assignments' do
637
+ vcr('entry/locales/simple_assignments_use_default_locale') do
638
+ space = Contentful::Management::Space.find('0agypmo1waov')
639
+ entry = space.entries.find('4epXENbO8wsaOukgqquYcI')
640
+
641
+ entry.yolo = 'changed'
642
+
643
+ expect(entry.fields).to match({:name => 'test2', :yolo => 'changed'})
644
+ end
645
+ end
646
+
647
+ it 'sets value for the specified locales when using *_with_locales' do
648
+ vcr('entry/locales/simple_assignments_use_specified_locale') do
649
+ space = Contentful::Management::Space.find('0agypmo1waov')
650
+ entry = space.entries.find('4epXENbO8wsaOukgqquYcI')
651
+
652
+ entry.yolo_with_locales = {'de-DE' => 'changed'}
653
+ entry.locale = 'de-DE'
654
+
655
+ expect(entry.fields).to match({:name => 'test2', :yolo => 'changed'})
656
+ end
657
+ end
609
658
  end
610
659
 
611
660
  describe '#fields_from_attributes' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-05-11 00:00:00.000000000 Z
13
+ date: 2015-06-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -333,11 +333,14 @@ files:
333
333
  - spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml
334
334
  - spec/fixtures/vcr_cassettes/entry/destory_published.yml
335
335
  - spec/fixtures/vcr_cassettes/entry/destroy.yml
336
+ - spec/fixtures/vcr_cassettes/entry/find-with-null-symbols.yml
336
337
  - spec/fixtures/vcr_cassettes/entry/find.yml
337
338
  - spec/fixtures/vcr_cassettes/entry/find_not_found.yml
338
339
  - spec/fixtures/vcr_cassettes/entry/limited_entries.yml
339
340
  - spec/fixtures/vcr_cassettes/entry/locales/fallback_to_default_locale.yml
340
341
  - spec/fixtures/vcr_cassettes/entry/locales/retrieve_localized.yml
342
+ - spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_default_locale.yml
343
+ - spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_specified_locale.yml
341
344
  - spec/fixtures/vcr_cassettes/entry/publish.yml
342
345
  - spec/fixtures/vcr_cassettes/entry/publish_already_published.yml
343
346
  - spec/fixtures/vcr_cassettes/entry/published_false.yml
@@ -366,6 +369,7 @@ files:
366
369
  - spec/fixtures/vcr_cassettes/entry/unpublish.yml
367
370
  - spec/fixtures/vcr_cassettes/entry/unpublish_already_unpublished.yml
368
371
  - spec/fixtures/vcr_cassettes/entry/update.yml
372
+ - spec/fixtures/vcr_cassettes/entry/update_bool_field.yml
369
373
  - spec/fixtures/vcr_cassettes/entry/update_unlocalized_field.yml
370
374
  - spec/fixtures/vcr_cassettes/entry/update_with_custom_locale.yml
371
375
  - spec/fixtures/vcr_cassettes/get_request.yml
@@ -567,11 +571,14 @@ test_files:
567
571
  - spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml
568
572
  - spec/fixtures/vcr_cassettes/entry/destory_published.yml
569
573
  - spec/fixtures/vcr_cassettes/entry/destroy.yml
574
+ - spec/fixtures/vcr_cassettes/entry/find-with-null-symbols.yml
570
575
  - spec/fixtures/vcr_cassettes/entry/find.yml
571
576
  - spec/fixtures/vcr_cassettes/entry/find_not_found.yml
572
577
  - spec/fixtures/vcr_cassettes/entry/limited_entries.yml
573
578
  - spec/fixtures/vcr_cassettes/entry/locales/fallback_to_default_locale.yml
574
579
  - spec/fixtures/vcr_cassettes/entry/locales/retrieve_localized.yml
580
+ - spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_default_locale.yml
581
+ - spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_specified_locale.yml
575
582
  - spec/fixtures/vcr_cassettes/entry/publish.yml
576
583
  - spec/fixtures/vcr_cassettes/entry/publish_already_published.yml
577
584
  - spec/fixtures/vcr_cassettes/entry/published_false.yml
@@ -600,6 +607,7 @@ test_files:
600
607
  - spec/fixtures/vcr_cassettes/entry/unpublish.yml
601
608
  - spec/fixtures/vcr_cassettes/entry/unpublish_already_unpublished.yml
602
609
  - spec/fixtures/vcr_cassettes/entry/update.yml
610
+ - spec/fixtures/vcr_cassettes/entry/update_bool_field.yml
603
611
  - spec/fixtures/vcr_cassettes/entry/update_unlocalized_field.yml
604
612
  - spec/fixtures/vcr_cassettes/entry/update_with_custom_locale.yml
605
613
  - spec/fixtures/vcr_cassettes/get_request.yml