contentful 0.3.4 → 0.3.5
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.
- checksums.yaml +7 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +43 -24
- data/README.md +22 -0
- data/RELEASE.md +8 -0
- data/Rakefile +4 -6
- data/contentful.gemspec +7 -9
- data/examples/custom_classes.rb +1 -2
- data/examples/dynamic_entries.rb +2 -4
- data/examples/example_queries.rb +2 -3
- data/examples/raise_errors.rb +3 -5
- data/examples/raw_mode.rb +2 -3
- data/examples/resource_mapping.rb +3 -4
- data/lib/contentful/array.rb +0 -1
- data/lib/contentful/asset.rb +1 -1
- data/lib/contentful/client.rb +47 -38
- data/lib/contentful/deleted_entry.rb +1 -1
- data/lib/contentful/request.rb +1 -2
- data/lib/contentful/resource.rb +1 -1
- data/lib/contentful/resource/array_like.rb +2 -3
- data/lib/contentful/resource/asset_fields.rb +1 -1
- data/lib/contentful/resource/fields.rb +2 -3
- data/lib/contentful/resource/system_properties.rb +1 -1
- data/lib/contentful/resource_builder.rb +14 -23
- data/lib/contentful/response.rb +40 -35
- data/lib/contentful/sync.rb +1 -3
- data/lib/contentful/sync_page.rb +2 -3
- data/lib/contentful/version.rb +1 -1
- data/spec/array_spec.rb +20 -20
- data/spec/asset_spec.rb +14 -14
- data/spec/auto_includes_spec.rb +4 -4
- data/spec/client_class_spec.rb +22 -24
- data/spec/client_configuration_spec.rb +48 -49
- data/spec/coercions_spec.rb +4 -4
- data/spec/content_type_spec.rb +12 -12
- data/spec/deleted_asset_spec.rb +10 -11
- data/spec/deleted_entry_spec.rb +9 -10
- data/spec/dynamic_entry_spec.rb +11 -11
- data/spec/entry_spec.rb +14 -14
- data/spec/error_class_spec.rb +15 -18
- data/spec/error_requests_spec.rb +6 -7
- data/spec/field_spec.rb +9 -9
- data/spec/file_spec.rb +7 -7
- data/spec/link_spec.rb +14 -14
- data/spec/locale_spec.rb +6 -6
- data/spec/location_spec.rb +10 -10
- data/spec/request_spec.rb +13 -13
- data/spec/resource_building_spec.rb +7 -8
- data/spec/resource_spec.rb +14 -14
- data/spec/response_spec.rb +25 -24
- data/spec/space_spec.rb +10 -10
- data/spec/spec_helper.rb +1 -2
- data/spec/support/json_responses.rb +2 -2
- data/spec/support/vcr.rb +3 -3
- data/spec/sync_page_spec.rb +26 -27
- data/spec/sync_spec.rb +22 -24
- metadata +41 -66
@@ -1,21 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
3
|
describe 'Resource Building Examples' do
|
5
4
|
it 'can deal with arrays' do
|
6
5
|
response = Contentful::Response.new raw_fixture('link_array')
|
7
6
|
resource = Contentful::ResourceBuilder.new(create_client, response).run
|
8
7
|
|
9
|
-
expect(
|
10
|
-
expect(
|
8
|
+
expect(resource.fields[:links]).to be_a Array
|
9
|
+
expect(resource.fields[:links].first).to be_a Contentful::Link
|
11
10
|
end
|
12
11
|
|
13
12
|
it 'replaces links with included versions if present' do
|
14
13
|
response = Contentful::Response.new raw_fixture('includes')
|
15
14
|
resource = Contentful::ResourceBuilder.new(create_client, response).run.first
|
16
15
|
|
17
|
-
expect(
|
18
|
-
expect(
|
16
|
+
expect(resource.fields[:links]).to be_a Array
|
17
|
+
expect(resource.fields[:links].first).to be_a Contentful::Entry
|
19
18
|
end
|
20
19
|
|
21
20
|
it 'can also reference itself' do
|
@@ -23,7 +22,7 @@ describe 'Resource Building Examples' do
|
|
23
22
|
resource = Contentful::ResourceBuilder.new(create_client, response).run.first
|
24
23
|
|
25
24
|
other_resource = resource.fields[:e]
|
26
|
-
expect(
|
27
|
-
expect(
|
25
|
+
expect(other_resource).to be_a Contentful::Entry
|
26
|
+
expect(other_resource.fields[:e]).to be resource
|
28
27
|
end
|
29
|
-
end
|
28
|
+
end
|
data/spec/resource_spec.rb
CHANGED
@@ -4,20 +4,20 @@ describe Contentful::Resource do
|
|
4
4
|
it 'must be included to get functionality' do
|
5
5
|
c = Class.new
|
6
6
|
c.send :include, Contentful::Resource
|
7
|
-
expect(
|
7
|
+
expect(c).to respond_to :property_coercions
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'creation' do
|
11
11
|
it 'must be initialized with a (hash) object' do
|
12
|
-
expect
|
12
|
+
expect do
|
13
13
|
Contentful::ContentType.new json_fixture('nyancat')
|
14
|
-
|
14
|
+
end.not_to raise_error
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can deal with invalid objects' do
|
18
|
-
expect
|
18
|
+
expect do
|
19
19
|
Contentful::ContentType.new({})
|
20
|
-
|
20
|
+
end.not_to raise_error
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -25,28 +25,28 @@ describe Contentful::Resource do
|
|
25
25
|
it 'will return a request object, if it has been initialized with one' do
|
26
26
|
request = Contentful::Request.new(nil, 'content_types')
|
27
27
|
resource = Contentful::ContentType.new({}, request)
|
28
|
-
expect(
|
28
|
+
expect(resource.request).to eq request
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#reload' do
|
33
|
-
let(:client){ create_client }
|
34
|
-
let(:entry){ vcr('entry'){ client.entry 'nyancat' } }
|
33
|
+
let(:client) { create_client }
|
34
|
+
let(:entry) { vcr('entry') { client.entry 'nyancat' } }
|
35
35
|
|
36
36
|
it 'triggers the request connected to the resource (again)' do
|
37
37
|
stub(entry.request).get
|
38
38
|
entry.reload
|
39
|
-
expect(
|
39
|
+
expect(entry.request).to have_received.get
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'the reloaded resource is different from the original one' do
|
43
|
-
reloaded_entry = vcr('reloaded_entry'){ entry.reload }
|
44
|
-
expect(
|
45
|
-
expect(
|
43
|
+
reloaded_entry = vcr('reloaded_entry') { entry.reload }
|
44
|
+
expect(reloaded_entry).to be_a Contentful::Entry
|
45
|
+
expect(reloaded_entry).not_to be entry
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'will return false if #request not available' do
|
49
|
-
expect(
|
49
|
+
expect(Contentful::ContentType.new({}).reload).to be_false
|
50
50
|
end
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
data/spec/response_spec.rb
CHANGED
@@ -1,61 +1,62 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Contentful::Response do
|
4
|
-
let(:successful_response){ Contentful::Response.new raw_fixture('nyancat'), Contentful::Request.new(nil, '/entries', nil, 'nyancat') }
|
5
|
-
let(:error_response){ Contentful::Response.new raw_fixture('not_found') }
|
6
|
-
let(:unparsable_response){ Contentful::Response.new raw_fixture('unparsable') }
|
4
|
+
let(:successful_response) { Contentful::Response.new raw_fixture('nyancat'), Contentful::Request.new(nil, '/entries', nil, 'nyancat') }
|
5
|
+
let(:error_response) { Contentful::Response.new raw_fixture('not_found', 404) }
|
6
|
+
let(:unparsable_response) { Contentful::Response.new raw_fixture('unparsable') }
|
7
7
|
|
8
|
-
describe
|
9
|
-
it
|
10
|
-
expect(
|
8
|
+
describe '#raw' do
|
9
|
+
it 'returns the raw response it has been initalized with' do
|
10
|
+
expect(successful_response.raw.to_s).to eql raw_fixture('nyancat').to_s
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe
|
14
|
+
describe '#object' do
|
15
15
|
it "returns the repsonse's parsed json" do
|
16
|
-
expect(
|
16
|
+
expect(successful_response.object).to eq json_fixture('nyancat')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
21
|
-
it
|
22
|
-
expect(
|
20
|
+
describe '#request' do
|
21
|
+
it 'returns the request the response has been initalized with' do
|
22
|
+
expect(successful_response.request).to be_a Contentful::Request
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
describe
|
26
|
+
describe '#status' do
|
27
27
|
it 'returns :ok for normal responses' do
|
28
|
-
expect(
|
28
|
+
expect(successful_response.status).to eq :ok
|
29
29
|
end
|
30
30
|
|
31
|
-
it 'returns :
|
32
|
-
expect(
|
31
|
+
it 'returns :error for error responses' do
|
32
|
+
expect(error_response.status).to eq :error
|
33
33
|
end
|
34
34
|
|
35
|
-
it 'returns :
|
36
|
-
expect(
|
35
|
+
it 'returns :error for unparsable json responses' do
|
36
|
+
expect(unparsable_response.status).to eq :error
|
37
37
|
end
|
38
38
|
|
39
|
-
it 'returns :
|
39
|
+
it 'returns :error for responses without content' do
|
40
40
|
raw_response = ''
|
41
|
-
stub(raw_response).status {204}
|
41
|
+
stub(raw_response).status { 204 }
|
42
42
|
no_content_response = Contentful::Response.new raw_response
|
43
|
-
expect(
|
43
|
+
expect(no_content_response.status).to eq :no_content
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
describe
|
47
|
+
describe '#error_message' do
|
48
48
|
it 'returns contentful error message for contentful errors' do
|
49
|
-
expect(
|
49
|
+
expect(error_response.error_message).to eq 'The resource could not be found.'
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'returns json parser error message for json parse errors' do
|
53
|
-
expect(
|
53
|
+
expect(unparsable_response.error_message).to include 'unexpected token'
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'returns a ServiceUnavailable error on a 503' do
|
57
57
|
error_response = Contentful::Response.new raw_fixture('not_found', 503)
|
58
|
-
expect(error_response.status).to eql :
|
58
|
+
expect(error_response.status).to eql :error
|
59
|
+
expect(error_response.object).to be_kind_of Contentful::ServiceUnavailable
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
data/spec/space_spec.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Contentful::Space do
|
4
|
-
let(:space){ vcr('space'){ create_client.space } }
|
4
|
+
let(:space) { vcr('space') { create_client.space } }
|
5
5
|
|
6
6
|
describe 'SystemProperties' do
|
7
7
|
it 'has a #sys getter returning a hash with symbol keys' do
|
8
|
-
expect(
|
9
|
-
expect(
|
8
|
+
expect(space.sys).to be_a Hash
|
9
|
+
expect(space.sys.keys.sample).to be_a Symbol
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'has #id' do
|
13
|
-
expect(
|
13
|
+
expect(space.id).to eq 'cfexampleapi'
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'has #type' do
|
17
|
-
expect(
|
17
|
+
expect(space.type).to eq 'Space'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'Properties' do
|
22
22
|
it 'has a #properties getter returning a hash with symbol keys' do
|
23
|
-
expect(
|
24
|
-
expect(
|
23
|
+
expect(space.properties).to be_a Hash
|
24
|
+
expect(space.properties.keys.sample).to be_a Symbol
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'has #name' do
|
28
|
-
expect(
|
28
|
+
expect(space.name).to eq 'Contentful Example API'
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'has #locales' do
|
32
|
-
expect(
|
33
|
-
expect(
|
32
|
+
expect(space.locales).to be_a Array
|
33
|
+
expect(space.locales.first).to be_a Contentful::Locale
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'multi_json'
|
2
2
|
|
3
|
-
def raw_fixture(which,status = 200,
|
3
|
+
def raw_fixture(which, status = 200, _as_json = false)
|
4
4
|
object = Object.new
|
5
5
|
stub(object).status { status }
|
6
6
|
stub(object).headers { {} }
|
@@ -9,7 +9,7 @@ def raw_fixture(which,status = 200, as_json = false)
|
|
9
9
|
object
|
10
10
|
end
|
11
11
|
|
12
|
-
def json_fixture(which,
|
12
|
+
def json_fixture(which, _as_json = false)
|
13
13
|
MultiJson.load(
|
14
14
|
File.read File.dirname(__FILE__) + "/../fixtures/json_responses/#{which}.json"
|
15
15
|
)
|
data/spec/support/vcr.rb
CHANGED
@@ -4,7 +4,7 @@ VCR.configure do |c|
|
|
4
4
|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
5
5
|
c.ignore_localhost = true
|
6
6
|
c.hook_into :webmock
|
7
|
-
c.default_cassette_options = { :
|
7
|
+
c.default_cassette_options = { record: :once }
|
8
8
|
end
|
9
9
|
|
10
10
|
def vcr(name, &block)
|
@@ -12,5 +12,5 @@ def vcr(name, &block)
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def expect_vcr(name, &block)
|
15
|
-
expect{ VCR.use_cassette(name, &block) }
|
16
|
-
end
|
15
|
+
expect { VCR.use_cassette(name, &block) }
|
16
|
+
end
|
data/spec/sync_page_spec.rb
CHANGED
@@ -1,109 +1,108 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
3
|
describe Contentful::SyncPage do
|
5
|
-
let(:page_with_more){ vcr('sync_page'){ create_client.sync(initial: true).first_page } }
|
6
|
-
let(:page){ vcr('sync_page_2'){ create_client.sync.get(
|
4
|
+
let(:page_with_more) { vcr('sync_page') { create_client.sync(initial: true).first_page } }
|
5
|
+
let(:page) { vcr('sync_page_2') { create_client.sync.get('https://cdn.contentful.com/spaces/cfexampleapi/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg') } }
|
7
6
|
|
8
7
|
describe 'SystemProperties' do
|
9
8
|
it 'has a #sys getter returning a hash with symbol keys' do
|
10
|
-
expect(
|
11
|
-
expect(
|
9
|
+
expect(page.sys).to be_a Hash
|
10
|
+
expect(page.sys.keys.sample).to be_a Symbol
|
12
11
|
end
|
13
12
|
|
14
13
|
it 'has #type' do
|
15
|
-
expect(
|
14
|
+
expect(page.type).to eq 'Array'
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
18
|
describe 'Properties' do
|
20
19
|
it 'has a #properties getter returning a hash with symbol keys' do
|
21
|
-
expect(
|
22
|
-
expect(
|
20
|
+
expect(page.properties).to be_a Hash
|
21
|
+
expect(page.properties.keys.sample).to be_a Symbol
|
23
22
|
end
|
24
23
|
|
25
24
|
it 'has #items which contain resources' do
|
26
|
-
expect(
|
27
|
-
expect(
|
25
|
+
expect(page_with_more.items).to be_a Array
|
26
|
+
expect(page_with_more.items.sample).to be_a Contentful::Resource
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
31
30
|
describe 'Fields' do
|
32
31
|
it 'properly deals with nested locale fields' do
|
33
|
-
expect(
|
32
|
+
expect(page_with_more.items.first.fields[:name]).to eq 'London'
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
36
|
describe '#each' do
|
38
37
|
it 'is an Enumerator' do
|
39
|
-
expect(
|
38
|
+
expect(page.each).to be_a Enumerator
|
40
39
|
end
|
41
40
|
|
42
41
|
it 'iterates over items' do
|
43
|
-
expect(
|
42
|
+
expect(page.each.to_a).to eq page.items
|
44
43
|
end
|
45
44
|
|
46
45
|
it 'includes Enumerable' do
|
47
|
-
expect(
|
46
|
+
expect(page.map { |r| r.type }).to eq page.items.map { |r| r.type }
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
50
|
describe '#next_sync_url' do
|
52
51
|
it 'will return the next_sync_url if there is one' do
|
53
|
-
expect(
|
52
|
+
expect(page.next_sync_url).to be_a String
|
54
53
|
end
|
55
54
|
|
56
55
|
it 'will return nil if note last page, yet' do
|
57
|
-
expect(
|
56
|
+
expect(page_with_more.next_sync_url).to be_nil
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
60
|
describe '#next_page_url' do
|
62
61
|
it 'will return the next_page_url if there is one' do
|
63
|
-
expect(
|
62
|
+
expect(page_with_more.next_page_url).to be_a String
|
64
63
|
end
|
65
64
|
|
66
65
|
it 'will return nil if on last page' do
|
67
|
-
expect(
|
66
|
+
expect(page.next_page_url).to be_nil
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
71
70
|
describe '#next_page' do
|
72
71
|
it 'requests the next page' do
|
73
|
-
next_page = vcr('sync_page_2')
|
72
|
+
next_page = vcr('sync_page_2')do
|
74
73
|
page_with_more.next_page
|
75
|
-
|
76
|
-
expect(
|
74
|
+
end
|
75
|
+
expect(next_page).to be_a Contentful::SyncPage
|
77
76
|
end
|
78
77
|
|
79
78
|
it 'will return nil if last page' do
|
80
|
-
expect(
|
79
|
+
expect(page.next_page_url).to be_nil
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
84
83
|
describe '#next_page?' do
|
85
84
|
it 'will return true if there is a next page' do
|
86
|
-
expect(
|
85
|
+
expect(page_with_more.next_page?).to be_true
|
87
86
|
end
|
88
87
|
|
89
88
|
it 'will return false if last page' do
|
90
|
-
expect(
|
89
|
+
expect(page.next_page?).to be_false
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
94
93
|
describe '#last_page?' do
|
95
94
|
it 'will return true if no more pages available' do
|
96
|
-
expect(
|
95
|
+
expect(page.last_page?).to be_true
|
97
96
|
end
|
98
97
|
|
99
98
|
it 'will return false if more pages available' do
|
100
|
-
expect(
|
99
|
+
expect(page_with_more.last_page?).to be_false
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
104
103
|
describe '#sync' do
|
105
104
|
it 'returns the sync that created the page' do
|
106
|
-
expect(
|
105
|
+
expect(page.sync).to be_a Contentful::Sync
|
107
106
|
end
|
108
107
|
end
|
109
108
|
end
|
data/spec/sync_spec.rb
CHANGED
@@ -1,41 +1,39 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
3
|
describe Contentful::Sync do
|
5
4
|
let(:first_page) do
|
6
|
-
vcr('sync_page')
|
5
|
+
vcr('sync_page')do
|
7
6
|
create_client.sync(initial: true).first_page
|
8
|
-
|
7
|
+
end
|
9
8
|
end
|
10
9
|
|
11
10
|
let(:last_page) do
|
12
|
-
vcr('sync_page')
|
13
|
-
vcr('sync_page_2')
|
11
|
+
vcr('sync_page')do
|
12
|
+
vcr('sync_page_2')do
|
14
13
|
create_client.sync(initial: true).first_page.next_page
|
15
|
-
|
16
|
-
|
14
|
+
end
|
15
|
+
end
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
18
|
describe '#initialize' do
|
21
19
|
it 'takes an options hash on initialization' do
|
22
|
-
expect
|
23
|
-
vcr('sync_deletion'){ create_client.sync(initial: true, type: 'Deletion').first_page }
|
24
|
-
|
20
|
+
expect do
|
21
|
+
vcr('sync_deletion') { create_client.sync(initial: true, type: 'Deletion').first_page }
|
22
|
+
end.not_to raise_exception
|
25
23
|
end
|
26
24
|
|
27
25
|
it 'takes a next_sync_url on initialization' do
|
28
|
-
expect
|
29
|
-
vcr('sync_page_2'){ create_client.sync(
|
30
|
-
|
26
|
+
expect do
|
27
|
+
vcr('sync_page_2') { create_client.sync('https://cdn.contentful.com/spaces/cfexampleapi/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg').first_page }
|
28
|
+
end.not_to raise_exception
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
32
|
describe '#first_page' do
|
35
33
|
it 'returns only the first page of a new sync' do
|
36
|
-
vcr('sync_page')
|
37
|
-
expect(
|
38
|
-
|
34
|
+
vcr('sync_page')do
|
35
|
+
expect(create_client.sync(initial: true).first_page).to be_a Contentful::SyncPage
|
36
|
+
end
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
@@ -45,31 +43,31 @@ describe Contentful::Sync do
|
|
45
43
|
vcr('sync_page'){ vcr('sync_page_2'){
|
46
44
|
count = 0
|
47
45
|
sync.each_page do |page|
|
48
|
-
expect(
|
46
|
+
expect(page).to be_a Contentful::SyncPage
|
49
47
|
count += 1
|
50
48
|
end
|
51
|
-
expect(
|
49
|
+
expect(count).to eq 2
|
52
50
|
}}
|
53
51
|
end
|
54
52
|
end
|
55
53
|
|
56
54
|
describe '#next_sync_url' do
|
57
55
|
it 'is empty if there are still more pages to request in the current sync' do
|
58
|
-
expect(
|
56
|
+
expect(first_page.next_sync_url).to be_nil
|
59
57
|
end
|
60
58
|
|
61
59
|
it 'returns the url to continue the sync next time' do
|
62
|
-
expect(
|
60
|
+
expect(last_page.next_sync_url).to be_a String
|
63
61
|
end
|
64
62
|
end
|
65
63
|
|
66
64
|
describe '#completed?' do
|
67
65
|
it 'will return true if no more pages to request in the current sync' do
|
68
|
-
expect(
|
66
|
+
expect(first_page.next_sync_url).to be_false
|
69
67
|
end
|
70
68
|
|
71
69
|
it 'will return true if not all pages requested, yet' do
|
72
|
-
expect(
|
70
|
+
expect(last_page.next_sync_url).to be_true
|
73
71
|
end
|
74
72
|
end
|
75
73
|
|
@@ -78,7 +76,7 @@ describe Contentful::Sync do
|
|
78
76
|
sync = create_client.sync(initial: true)
|
79
77
|
vcr('sync_page'){ vcr('sync_page_2'){
|
80
78
|
sync.each_item do |item|
|
81
|
-
expect(
|
79
|
+
expect(item).to be_a Contentful::Resource
|
82
80
|
end
|
83
81
|
}}
|
84
82
|
end
|