spec/lib/contentful/management/entry_spec.rb in contentful-management-3.5.0 vs spec/lib/contentful/management/entry_spec.rb in contentful-management-3.6.0
- old
+ new
@@ -454,10 +454,15 @@
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 'too many requests auto-retry' do
- vcr('entry/too_many_requests_retry') do
+ # Testing that the header versions are not cleared between retries
+ header_matcher = lambda do |request_1, request_2|
+ request_1.headers["X-Contentful-Version"] == request_2.headers["X-Contentful-Version"]
+ end
+
+ VCR.use_cassette('entry/too_many_requests_retry', match_requests_on: [:method, :uri, header_matcher]) do
logger = RetryLoggerMock.new(STDOUT)
space = Contentful::Management::Client.new(token, raise_errors: true, logger: logger).spaces.find('286arvy86ry9')
invalid_entry = client.entries(space.id, 'master').find('1YNepnMpXGiMWikaKC4GG0')
ct = client.content_types(space.id, 'master').find('5lIEiXrCIoKoIKaSW2C8aa')
entry = ct.entries.create(name: 'Create test', entry: invalid_entry)