Sfoglia il codice sorgente

Adding tests for FulfillmentService

Ben Cox 11 anni fa
parent
commit
6dad932867
2 ha cambiato i file con 26 aggiunte e 0 eliminazioni
  1. 10 0
      test/fixtures/fulfillment_service.json
  2. 16 0
      test/fulfillment_service_test.rb

+ 10 - 0
test/fixtures/fulfillment_service.json

@@ -0,0 +1,10 @@
+{
+	"fulfillment_service": {
+		"name": "SomeService",
+		"id": 123456,
+		"inventory_management": false,
+		"tracking_support": true,
+		"requires_shipping_method": false,
+		"format": "json"
+	}
+}

+ 16 - 0
test/fulfillment_service_test.rb

@@ -0,0 +1,16 @@
+require 'test_helper'
+
+class FulFillmentServiceTest < Test::Unit::TestCase
+	test 'new should create fulfillment service' do
+		fake "fulfillment_service", :method => :post
+		fulfillment_service = ShopifyAPI::FulfillmentService.new(:name => "SomeService")
+		assert_equal "SomeService" , fulfillment_service.name
+	end
+
+	test 'find should return the fulfillment service' do
+		fake "fulfillment_service/123456.json", :method => :get, :body => load_fixture('fulfillment_service')
+		fulfillment_service = ShopifyAPI::FulfillmentService.find(123456)
+		assert_equal 123456 , fulfillment_service.id
+		assert_equal "SomeService", fulfillment_service.name
+	end
+end