Sha256: 2e04a3b5f99ac29ac916c104d192aa1ce7b765483b054e7e507e6799464f9694

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

describe ShippingEasy::Resources::Order do

  describe ".find_all" do
    it "sends a request with the expected options" do

      ShippingEasy::Resources::Order.should_receive(:execute_request!).with({:relative_path=>"/orders",
                                                              :http_method=>:get,
                                                              :params => {:page => 2,
                                                                          :per_page => 3,
                                                                          :status => [:shipped]}})

      ShippingEasy::Resources::Order.find_all(:page => 2, :per_page => 3, :status => [:shipped])
    end
  end

  describe ".find" do
    it "sends a request with the expected options" do
      ShippingEasy::Resources::Order.should_receive(:execute_request!).with({:relative_path=>"/orders/2", :http_method=>:get})
      ShippingEasy::Resources::Order.find(:id => 2)
    end
  end

  describe ".create" do
    it "sends a request with the expected options" do
      ShippingEasy::Resources::Order.should_receive(:execute_request!).with({:relative_path=>"/stores/123456/orders", :http_method=>:post, payload: { name: "Jack" }})
      ShippingEasy::Resources::Order.create(:store_api_key => "123456", payload: { name: "Jack" })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shipping_easy-0.3.2 spec/resources/order_spec.rb
shipping_easy-0.3.1 spec/resources/order_spec.rb
shipping_easy-0.3.0 spec/resources/order_spec.rb