spec/moip2/order_api_spec.rb in moip2-1.0.0 vs spec/moip2/order_api_spec.rb in moip2-1.1.0
- old
+ new
@@ -74,11 +74,11 @@
expect(created_order.customer.shipping_address).to_not be_nil
expect(created_order.customer._links).to_not be_nil
expect(
created_order.customer._links.self.href,
- ).to eq "#{ENV['sandbox_url']}/v2/customers/CUS-B6LE6HLFFXKF"
+ ).to eq "https://sandbox.moip.com.br/v2/customers/CUS-B6LE6HLFFXKF"
end
it "returns an Order object" do
expect(created_order).to be_a(Moip2::Resource::Order)
end
@@ -210,9 +210,32 @@
it "all orders satisfy the amount constraint" do
expect(response.orders).to satisfy do |orders|
orders.all? { |order| order.amount.total.between?(500, 1000) }
end
+ end
+ end
+
+ context "when passing ownID search with `q`" do
+ subject(:response) do
+ VCR.use_cassette("find_all_orders_q_search") do
+ order_api.find_all(q: "25051990")
+ end
+ end
+
+ it { expect(response).to be_a(Moip2::Resource::Order) }
+ it { expect(response._links).not_to be_nil }
+ it { expect(response.summary).not_to be_nil }
+
+ it "_links.next has the right filters" do
+ expect(response._links.next.href).to eq(
+ "https://test.moip.com.br/v2/orders" \
+ "?q=25051990&filters=&limit=0&offset=0",
+ )
+ end
+
+ it "all orders satisfy the status constraint" do
+ expect(response.orders.first.own_id).to eq("25051990")
end
end
end
end