test/integrations/order_test.rb in geocerts-0.0.15 vs test/integrations/order_test.rb in geocerts-0.0.16
- old
+ new
@@ -33,11 +33,11 @@
assert_equal(false, order.trial)
assert_equal(false, order.renewal)
assert_equal('', order.sans)
assert_equal('COMPLETED', order.state)
assert_equal(69.00, order.total_price)
- assert_equal(false, order.pending_audit)
+ assert_equal(false, order.flagged)
end
end
should 'set the end at time' do
exclusively_mocked_request :get, '/orders.xml', :response => Responses::Order::All do
@@ -90,11 +90,11 @@
assert_equal(false, order.trial)
assert_equal(false, order.renewal)
assert_equal('', order.sans)
assert_equal('COMPLETED', order.state)
assert_equal(69.00, order.total_price)
- assert_equal(false, order.pending_audit)
+ assert_equal(false, order.flagged)
end
end
should 'raise a ResourceNotFound error' do
managed_server_request :get, '/orders/999999999.xml', :response => Responses::InvalidOrderId do
@@ -102,10 +102,21 @@
GeoCerts::Order.find(999999999)
end
end
end
+ should 'load the product when requested' do
+ exclusively_mocked_request :get, "/orders/#{@order_id}.xml", :response => Responses::Order::Order do
+ order = GeoCerts::Order.find(@order_id)
+ assert_equal(nil, order.instance_variable_get("@product"))
+ exclusively_mocked_request :get, "/products.xml", :response => Responses::Product::All do
+ assert_kind_of(GeoCerts::Product, order.product)
+ assert_equal('Q', order.product.sku)
+ end
+ end
+ end
+
end
context 'find_by_id' do
setup do
@@ -137,10 +148,10 @@
assert_equal(false, order.trial)
assert_equal(false, order.renewal)
assert_equal('', order.sans)
assert_equal('COMPLETED', order.state)
assert_equal(69.00, order.total_price)
- assert_equal(false, order.pending_audit)
+ assert_equal(false, order.flagged)
end
end
should 'raise a ResourceNotFound error' do
managed_server_request :get, '/orders/999999999.xml', :response => Responses::InvalidOrderId do