Sha256: 240b32b5dc1b75a73c18c4dc346e632f66a434c736402bac4b7ddde32d007e94

Contents?: true

Size: 714 Bytes

Versions: 14

Compression:

Stored size: 714 Bytes

Contents

require_relative '../../spec_helper'

describe 'POST /orders/{order_num}/cancel' do
  let(:client) { Rev.new('welcome', 'AAAAAu/YjZ3phXU5FsF35yIcgiA=', 'www.revtrunk.com') }

  it 'must cancel order' do
    VCR.insert_cassette 'cancel_order'

    client.cancel_order('TC0166192942').must_equal true

    assert_requested :post, /.*\/api\/v1\/orders\/TC0166192942\/cancel/, :times => 1,
      :body => { :order_num => 'TC0166192942' }
  end

  it 'must raise ForbiddenError when cancellation is not allowed' do
    VCR.insert_cassette 'cancel_order_not_allowed'

    action = lambda { client.cancel_order('TC0367111289') }
    action.must_raise Rev::ForbiddenError
  end

  after do
    VCR.eject_cassette
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rev-api-2.4.0 spec/lib/rev/cancel_order_spec.rb
rev-api-2.3.2 spec/lib/rev/cancel_order_spec.rb
rev-api-2.3.0 spec/lib/rev/cancel_order_spec.rb
rev-api-2.2.1 spec/lib/rev/cancel_order_spec.rb
rev-api-2.1.0 spec/lib/rev/cancel_order_spec.rb
rev-api-2.0.3 spec/lib/rev/cancel_order_spec.rb
rev-api-2.0.2 spec/lib/rev/cancel_order_spec.rb
rev-api-2.0.1 spec/lib/rev/cancel_order_spec.rb
rev-api-2.0.0 spec/lib/rev/cancel_order_spec.rb
rev-api-1.0.4 spec/lib/rev/cancel_order_spec.rb
rev-api-1.0.3 spec/lib/rev/cancel_order_spec.rb
rev-api-1.0.2 spec/lib/rev/cancel_order_spec.rb
rev-api-1.0.1 spec/lib/rev/cancel_order_spec.rb
rev-api-1.0.0 spec/lib/rev/cancel_order_spec.rb