Sha256: ed5babfb735ef236103f6f98b1f93f04e83bf3ea9558d884ff93baf036531410

Contents?: true

Size: 847 Bytes

Versions: 2

Compression:

Stored size: 847 Bytes

Contents

require 'spec_helper'

describe 'Error Requests' do
  it 'will return 404 (Unauthorized) if resource not found' do
    expect_vcr('not found')do
      create_client.entry 'not found'
    end.to raise_error(Contentful::NotFound)
  end

  it 'will return 400 (BadRequest) if invalid parameters have been passed' do
    expect_vcr('bad request')do
      create_client.entries(some: 'parameter')
    end.to raise_error(Contentful::BadRequest)
  end

  it 'will return 403 (AccessDenied) if ...' do
    pending
  end

  it 'will return 401 (Unauthorized) if wrong credentials given' do
    client = Contentful::Client.new(space: 'wrong', access_token: 'credentials')

    expect_vcr('unauthorized'){
      client.entry 'nyancat'
    }.to raise_error(Contentful::Unauthorized)
  end

  it 'will return 500 (ServerError) if ...' do
    pending
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contentful-0.4.0 spec/error_requests_spec.rb
contentful-0.3.5 spec/error_requests_spec.rb