shopify-mock 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/README.rdoc +40 -22
- data/Rakefile +9 -0
- data/lib/shopify-mock.rb +4 -3
- data/lib/shopify-mock/fixtures.rb +11 -2
- data/lib/shopify-mock/fixtures/{articles.json → json/articles.json} +0 -0
- data/lib/shopify-mock/fixtures/{assets.json → json/assets.json} +0 -0
- data/lib/shopify-mock/fixtures/{blogs.json → json/blogs.json} +0 -0
- data/lib/shopify-mock/fixtures/{collect.json → json/collect.json} +0 -0
- data/lib/shopify-mock/fixtures/{comments.json → json/comments.json} +0 -0
- data/lib/shopify-mock/fixtures/{count.json → json/count.json} +0 -0
- data/lib/shopify-mock/fixtures/{countries.json → json/countries.json} +0 -0
- data/lib/shopify-mock/fixtures/{custom_collections.json → json/custom_collections.json} +0 -0
- data/lib/shopify-mock/fixtures/{customer_groups.json → json/customer_groups.json} +0 -0
- data/lib/shopify-mock/fixtures/{customers.json → json/customers.json} +0 -0
- data/lib/shopify-mock/fixtures/{events.json → json/events.json} +0 -0
- data/lib/shopify-mock/fixtures/{fulfillments.json → json/fulfillments.json} +0 -0
- data/lib/shopify-mock/fixtures/{images.json → json/images.json} +0 -0
- data/lib/shopify-mock/fixtures/{metafields.json → json/metafields.json} +0 -0
- data/lib/shopify-mock/fixtures/{orders.json → json/orders.json} +0 -0
- data/lib/shopify-mock/fixtures/{pages.json → json/pages.json} +0 -0
- data/lib/shopify-mock/fixtures/{product_search_engines.json → json/product_search_engines.json} +0 -0
- data/lib/shopify-mock/fixtures/{products.json → json/products.json} +0 -0
- data/lib/shopify-mock/fixtures/{provinces.json → json/provinces.json} +0 -0
- data/lib/shopify-mock/fixtures/{redirects.json → json/redirects.json} +0 -0
- data/lib/shopify-mock/fixtures/{script_tags.json → json/script_tags.json} +0 -0
- data/lib/shopify-mock/fixtures/{shop.json → json/shop.json} +0 -0
- data/lib/shopify-mock/fixtures/{smart_collections.json → json/smart_collections.json} +0 -0
- data/lib/shopify-mock/fixtures/{test.json → json/test.json} +0 -0
- data/lib/shopify-mock/fixtures/{themes.json → json/themes.json} +0 -0
- data/lib/shopify-mock/fixtures/{transactions.json → json/transactions.json} +0 -0
- data/lib/shopify-mock/fixtures/{variants.json → json/variants.json} +0 -0
- data/lib/shopify-mock/fixtures/{webhooks.json → json/webhooks.json} +0 -0
- data/lib/shopify-mock/fixtures/xml/articles.xml +29 -0
- data/lib/shopify-mock/fixtures/xml/assets.xml +135 -0
- data/lib/shopify-mock/fixtures/xml/blogs.xml +14 -0
- data/lib/shopify-mock/fixtures/xml/collect.xml +10 -0
- data/lib/shopify-mock/fixtures/xml/comments.xml +18 -0
- data/lib/shopify-mock/fixtures/xml/count.xml +2 -0
- data/lib/shopify-mock/fixtures/xml/countries.xml +15 -0
- data/lib/shopify-mock/fixtures/xml/custom_collections.xml +13 -0
- data/lib/shopify-mock/fixtures/xml/customer_groups.xml +24 -0
- data/lib/shopify-mock/fixtures/xml/customers.xml +31 -0
- data/lib/shopify-mock/fixtures/xml/events.xml +12 -0
- data/lib/shopify-mock/fixtures/xml/fulfillments.xml +34 -0
- data/lib/shopify-mock/fixtures/xml/images.xml +11 -0
- data/lib/shopify-mock/fixtures/xml/metafields.xml +13 -0
- data/lib/shopify-mock/fixtures/xml/orders.xml +140 -0
- data/lib/shopify-mock/fixtures/xml/pages.xml +15 -0
- data/lib/shopify-mock/fixtures/xml/product_search_engines.xml +7 -0
- data/lib/shopify-mock/fixtures/xml/products.xml +113 -0
- data/lib/shopify-mock/fixtures/xml/provinces.xml +99 -0
- data/lib/shopify-mock/fixtures/xml/redirects.xml +18 -0
- data/lib/shopify-mock/fixtures/xml/script_tags.xml +10 -0
- data/lib/shopify-mock/fixtures/xml/shop.xml +25 -0
- data/lib/shopify-mock/fixtures/xml/smart_collections.xml +20 -0
- data/lib/shopify-mock/fixtures/xml/test.xml +2 -0
- data/lib/shopify-mock/fixtures/xml/themes.xml +24 -0
- data/lib/shopify-mock/fixtures/xml/transactions.xml +14 -0
- data/lib/shopify-mock/fixtures/xml/variants.xml +83 -0
- data/lib/shopify-mock/fixtures/xml/webhooks.xml +11 -0
- data/shopify-mock.gemspec +2 -1
- data/spec/fixtures_spec.rb +1 -1
- data/spec/mock_spec.rb +15 -0
- data/spec/response_spec.rb +3 -1
- metadata +72 -33
@@ -0,0 +1,99 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<provinces type="array">
|
3
|
+
<province>
|
4
|
+
<tax type="float">0.08</tax>
|
5
|
+
<name>Alberta</name>
|
6
|
+
<tax-name nil="true"></tax-name>
|
7
|
+
<code>AB</code>
|
8
|
+
<id type="integer">205434194</id>
|
9
|
+
<tax-type nil="true"></tax-type>
|
10
|
+
</province>
|
11
|
+
<province>
|
12
|
+
<tax type="float">0.07</tax>
|
13
|
+
<name>British Columbia</name>
|
14
|
+
<tax-name nil="true"></tax-name>
|
15
|
+
<code>BC</code>
|
16
|
+
<id type="integer">170405627</id>
|
17
|
+
<tax-type nil="true"></tax-type>
|
18
|
+
</province>
|
19
|
+
<province>
|
20
|
+
<tax type="float">0.07</tax>
|
21
|
+
<name>Manitoba</name>
|
22
|
+
<tax-name nil="true"></tax-name>
|
23
|
+
<code>MB</code>
|
24
|
+
<id type="integer">342345110</id>
|
25
|
+
<tax-type nil="true"></tax-type>
|
26
|
+
</province>
|
27
|
+
<province>
|
28
|
+
<tax type="float">0.15</tax>
|
29
|
+
<name>New Brunswick</name>
|
30
|
+
<tax-name nil="true"></tax-name>
|
31
|
+
<code>NB</code>
|
32
|
+
<id type="integer">92264567</id>
|
33
|
+
<tax-type nil="true"></tax-type>
|
34
|
+
</province>
|
35
|
+
<province>
|
36
|
+
<tax type="float">0.15</tax>
|
37
|
+
<name>Newfoundland</name>
|
38
|
+
<tax-name nil="true"></tax-name>
|
39
|
+
<code>NF</code>
|
40
|
+
<id type="integer">243284171</id>
|
41
|
+
<tax-type nil="true"></tax-type>
|
42
|
+
</province>
|
43
|
+
<province>
|
44
|
+
<tax type="float">0.0</tax>
|
45
|
+
<name>Northwest Territories</name>
|
46
|
+
<tax-name nil="true"></tax-name>
|
47
|
+
<code>NT</code>
|
48
|
+
<id type="integer">439598329</id>
|
49
|
+
<tax-type nil="true"></tax-type>
|
50
|
+
</province>
|
51
|
+
<province>
|
52
|
+
<tax type="float">0.15</tax>
|
53
|
+
<name>Nova Scotia</name>
|
54
|
+
<tax-name nil="true"></tax-name>
|
55
|
+
<code>NS</code>
|
56
|
+
<id type="integer">448070559</id>
|
57
|
+
<tax-type nil="true"></tax-type>
|
58
|
+
</province>
|
59
|
+
<province>
|
60
|
+
<tax type="float">0.0</tax>
|
61
|
+
<name>Nunavut</name>
|
62
|
+
<tax-name nil="true"></tax-name>
|
63
|
+
<code>NU</code>
|
64
|
+
<id type="integer">670206421</id>
|
65
|
+
<tax-type nil="true"></tax-type>
|
66
|
+
</province>
|
67
|
+
<province>
|
68
|
+
<tax type="float">0.08</tax>
|
69
|
+
<name>Ontario</name>
|
70
|
+
<tax-name nil="true"></tax-name>
|
71
|
+
<code>ON</code>
|
72
|
+
<id type="integer">702530425</id>
|
73
|
+
<tax-type nil="true"></tax-type>
|
74
|
+
</province>
|
75
|
+
<province>
|
76
|
+
<tax type="float">0.1</tax>
|
77
|
+
<name>Prince Edward Island</name>
|
78
|
+
<tax-name nil="true"></tax-name>
|
79
|
+
<code>PE</code>
|
80
|
+
<id type="integer">570891722</id>
|
81
|
+
<tax-type nil="true"></tax-type>
|
82
|
+
</province>
|
83
|
+
<province>
|
84
|
+
<tax type="float">0.09</tax>
|
85
|
+
<name>Quebec</name>
|
86
|
+
<tax-name nil="true"></tax-name>
|
87
|
+
<code>QC</code>
|
88
|
+
<id type="integer">224293623</id>
|
89
|
+
<tax-type nil="true"></tax-type>
|
90
|
+
</province>
|
91
|
+
<province>
|
92
|
+
<tax type="float">0.0</tax>
|
93
|
+
<name>Yukon</name>
|
94
|
+
<tax-name nil="true"></tax-name>
|
95
|
+
<code>YT</code>
|
96
|
+
<id type="integer">1005264686</id>
|
97
|
+
<tax-type nil="true"></tax-type>
|
98
|
+
</province>
|
99
|
+
</provinces>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<redirects type="array">
|
3
|
+
<redirect>
|
4
|
+
<id type="integer">304339089</id>
|
5
|
+
<path>/products.php</path>
|
6
|
+
<target>/products</target>
|
7
|
+
</redirect>
|
8
|
+
<redirect>
|
9
|
+
<id type="integer">668809255</id>
|
10
|
+
<path>/leopard</path>
|
11
|
+
<target>/pages/macosx</target>
|
12
|
+
</redirect>
|
13
|
+
<redirect>
|
14
|
+
<id type="integer">950115854</id>
|
15
|
+
<path>/ibook</path>
|
16
|
+
<target>/products/macbook</target>
|
17
|
+
</redirect>
|
18
|
+
</redirects>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<script-tags type="array">
|
3
|
+
<script-tag>
|
4
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
5
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
6
|
+
<src>http://js-aplenty.com/foo.js</src>
|
7
|
+
<id type="integer">596726825</id>
|
8
|
+
<event>onload</event>
|
9
|
+
</script-tag>
|
10
|
+
</script-tags>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<shop>
|
3
|
+
<name>Apple Computers</name>
|
4
|
+
<city>Cupertino</city>
|
5
|
+
<address1>1 Infinite Loop</address1>
|
6
|
+
<zip>95014</zip>
|
7
|
+
<created-at type="datetime">2007-12-31T19:00:00-05:00</created-at>
|
8
|
+
<public type="boolean">false</public>
|
9
|
+
<country>US</country>
|
10
|
+
<domain>shop.apple.com</domain>
|
11
|
+
<id type="integer">690933842</id>
|
12
|
+
<phone nil="true"></phone>
|
13
|
+
<source nil="true"></source>
|
14
|
+
<province>CA</province>
|
15
|
+
<email>steve@apple.com</email>
|
16
|
+
<currency>USD</currency>
|
17
|
+
<timezone>(GMT-05:00) Eastern Time (US & Canada)</timezone>
|
18
|
+
<shop-owner>Steve Jobs</shop-owner>
|
19
|
+
<money-format>$ {{amount}}</money-format>
|
20
|
+
<money-with-currency-format>$ {{amount}} USD</money-with-currency-format>
|
21
|
+
<taxes-included nil="true"></taxes-included>
|
22
|
+
<tax-shipping nil="true"></tax-shipping>
|
23
|
+
<plan-name>enterprise</plan-name>
|
24
|
+
<myshopify-domain>apple.myshopify.com</myshopify-domain>
|
25
|
+
</shop>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<smart-collections type="array">
|
3
|
+
<smart-collection>
|
4
|
+
<body-html><p>The best selling ipod ever</p></body-html>
|
5
|
+
<handle>smart-ipods</handle>
|
6
|
+
<template-suffix nil="true"></template-suffix>
|
7
|
+
<title>Smart iPods</title>
|
8
|
+
<updated-at type="datetime">2008-02-01T19:00:00-05:00</updated-at>
|
9
|
+
<sort-order>manual</sort-order>
|
10
|
+
<id type="integer">482865238</id>
|
11
|
+
<published-at type="datetime">2008-02-01T19:00:00-05:00</published-at>
|
12
|
+
<rules type="array">
|
13
|
+
<rule>
|
14
|
+
<column>type</column>
|
15
|
+
<relation>equals</relation>
|
16
|
+
<condition>Cult Products</condition>
|
17
|
+
</rule>
|
18
|
+
</rules>
|
19
|
+
</smart-collection>
|
20
|
+
</smart-collections>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<themes type="array">
|
3
|
+
<theme>
|
4
|
+
<name>Comfort</name>
|
5
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
6
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
7
|
+
<role>main</role>
|
8
|
+
<id type="integer">828155753</id>
|
9
|
+
</theme>
|
10
|
+
<theme>
|
11
|
+
<name>Speed</name>
|
12
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
13
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
14
|
+
<role>mobile</role>
|
15
|
+
<id type="integer">976877075</id>
|
16
|
+
</theme>
|
17
|
+
<theme>
|
18
|
+
<name>Sandbox</name>
|
19
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
20
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
21
|
+
<role>unpublished</role>
|
22
|
+
<id type="integer">752253240</id>
|
23
|
+
</theme>
|
24
|
+
</themes>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<transactions type="array">
|
3
|
+
<transaction>
|
4
|
+
<kind>capture</kind>
|
5
|
+
<created-at type="datetime">2011-09-06T12:02:14-04:00</created-at>
|
6
|
+
<order-id type="integer">450789469</order-id>
|
7
|
+
<amount type="decimal">10.0</amount>
|
8
|
+
<authorization nil="true"></authorization>
|
9
|
+
<status>success</status>
|
10
|
+
<receipt type="yaml">--- {}
|
11
|
+
|
12
|
+
</receipt>
|
13
|
+
</transaction>
|
14
|
+
</transactions>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<variants type="array">
|
3
|
+
<variant>
|
4
|
+
<price type="decimal">199.0</price>
|
5
|
+
<position type="integer">1</position>
|
6
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
7
|
+
<title>Pink</title>
|
8
|
+
<requires-shipping type="boolean">true</requires-shipping>
|
9
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
10
|
+
<inventory-policy>continue</inventory-policy>
|
11
|
+
<compare-at-price type="decimal" nil="true"></compare-at-price>
|
12
|
+
<inventory-management>shopify</inventory-management>
|
13
|
+
<taxable type="boolean">true</taxable>
|
14
|
+
<id type="integer">808950810</id>
|
15
|
+
<grams type="integer">200</grams>
|
16
|
+
<sku>IPOD2008PINK</sku>
|
17
|
+
<option1>Pink</option1>
|
18
|
+
<option2 nil="true"></option2>
|
19
|
+
<fulfillment-service>manual</fulfillment-service>
|
20
|
+
<option3 nil="true"></option3>
|
21
|
+
<inventory-quantity type="integer">10</inventory-quantity>
|
22
|
+
</variant>
|
23
|
+
<variant>
|
24
|
+
<price type="decimal">199.0</price>
|
25
|
+
<position type="integer">2</position>
|
26
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
27
|
+
<title>Red</title>
|
28
|
+
<requires-shipping type="boolean">true</requires-shipping>
|
29
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
30
|
+
<inventory-policy>continue</inventory-policy>
|
31
|
+
<compare-at-price type="decimal" nil="true"></compare-at-price>
|
32
|
+
<inventory-management>shopify</inventory-management>
|
33
|
+
<taxable type="boolean">true</taxable>
|
34
|
+
<id type="integer">49148385</id>
|
35
|
+
<grams type="integer">200</grams>
|
36
|
+
<sku>IPOD2008RED</sku>
|
37
|
+
<option1>Red</option1>
|
38
|
+
<option2 nil="true"></option2>
|
39
|
+
<fulfillment-service>manual</fulfillment-service>
|
40
|
+
<option3 nil="true"></option3>
|
41
|
+
<inventory-quantity type="integer">20</inventory-quantity>
|
42
|
+
</variant>
|
43
|
+
<variant>
|
44
|
+
<price type="decimal">199.0</price>
|
45
|
+
<position type="integer">3</position>
|
46
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
47
|
+
<title>Green</title>
|
48
|
+
<requires-shipping type="boolean">true</requires-shipping>
|
49
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
50
|
+
<inventory-policy>continue</inventory-policy>
|
51
|
+
<compare-at-price type="decimal" nil="true"></compare-at-price>
|
52
|
+
<inventory-management>shopify</inventory-management>
|
53
|
+
<taxable type="boolean">true</taxable>
|
54
|
+
<id type="integer">39072856</id>
|
55
|
+
<grams type="integer">200</grams>
|
56
|
+
<sku>IPOD2008GREEN</sku>
|
57
|
+
<option1>Green</option1>
|
58
|
+
<option2 nil="true"></option2>
|
59
|
+
<fulfillment-service>manual</fulfillment-service>
|
60
|
+
<option3 nil="true"></option3>
|
61
|
+
<inventory-quantity type="integer">30</inventory-quantity>
|
62
|
+
</variant>
|
63
|
+
<variant>
|
64
|
+
<price type="decimal">199.0</price>
|
65
|
+
<position type="integer">4</position>
|
66
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
67
|
+
<title>Black</title>
|
68
|
+
<requires-shipping type="boolean">true</requires-shipping>
|
69
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
70
|
+
<inventory-policy>continue</inventory-policy>
|
71
|
+
<compare-at-price type="decimal" nil="true"></compare-at-price>
|
72
|
+
<inventory-management>shopify</inventory-management>
|
73
|
+
<taxable type="boolean">true</taxable>
|
74
|
+
<id type="integer">457924702</id>
|
75
|
+
<grams type="integer">200</grams>
|
76
|
+
<sku>IPOD2008BLACK</sku>
|
77
|
+
<option1>Black</option1>
|
78
|
+
<option2 nil="true"></option2>
|
79
|
+
<fulfillment-service>manual</fulfillment-service>
|
80
|
+
<option3 nil="true"></option3>
|
81
|
+
<inventory-quantity type="integer">40</inventory-quantity>
|
82
|
+
</variant>
|
83
|
+
</variants>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<webhooks type="array">
|
3
|
+
<webhook>
|
4
|
+
<address>http://apple.com/uninstall</address>
|
5
|
+
<format>xml</format>
|
6
|
+
<created-at type="datetime">2011-09-06T11:58:19-04:00</created-at>
|
7
|
+
<updated-at type="datetime">2011-09-06T11:58:19-04:00</updated-at>
|
8
|
+
<topic>app/uninstalled</topic>
|
9
|
+
<id type="integer">901431826</id>
|
10
|
+
</webhook>
|
11
|
+
</webhooks>
|
data/shopify-mock.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "shopify-mock"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.1"
|
7
7
|
s.authors = ["Travis Haynes"]
|
8
8
|
s.email = ["travis.j.haynes@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/travishaynes/shopify-mock"
|
@@ -24,4 +24,5 @@ browser, or in the console.}
|
|
24
24
|
|
25
25
|
s.add_dependency("fakeweb", [">= 1.3.0"])
|
26
26
|
s.add_dependency("rspec", [">= 2.6.0"])
|
27
|
+
s.add_dependency("rake", [">= 0.8.7"])
|
27
28
|
end
|
data/spec/fixtures_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe ShopifyAPI::Mock::Fixture do
|
|
11
11
|
|
12
12
|
context "with valid file name" do
|
13
13
|
before do
|
14
|
-
@file_name = File.expand_path("../../lib/shopify-mock/fixtures/orders.json", __FILE__)
|
14
|
+
@file_name = File.expand_path("../../lib/shopify-mock/fixtures/json/orders.json", __FILE__)
|
15
15
|
@fixture = ShopifyAPI::Mock::Fixture.new(@file_name)
|
16
16
|
end
|
17
17
|
specify { @fixture.should be_a ShopifyAPI::Mock::Fixture }
|
data/spec/mock_spec.rb
CHANGED
@@ -2,6 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ShopifyAPI::Mock do
|
4
4
|
|
5
|
+
after(:all) do
|
6
|
+
# reset things back to the way they were before these tests ran
|
7
|
+
ShopifyAPI::Mock.enabled = false # disable and
|
8
|
+
ShopifyAPI::Mock.enabled = true # re-enable to ensure mocks reset
|
9
|
+
ShopifyAPI::Mock.allow_internet = false
|
10
|
+
end
|
11
|
+
|
5
12
|
describe "#enabled=" do
|
6
13
|
context "given true" do
|
7
14
|
before { ShopifyAPI::Mock.enabled = true }
|
@@ -27,6 +34,14 @@ describe ShopifyAPI::Mock do
|
|
27
34
|
end
|
28
35
|
|
29
36
|
context "while ShopifyAPI::Mock is enabled" do
|
37
|
+
before { ShopifyAPI::Mock.enabled = true }
|
38
|
+
|
39
|
+
it "should reset back to original responses" do
|
40
|
+
ShopifyAPI::Mock::Response.clear
|
41
|
+
ShopifyAPI::Mock::Response.all.count.should eq 0
|
42
|
+
ShopifyAPI::Mock.reset
|
43
|
+
ShopifyAPI::Mock::Response.all.count.should > 0
|
44
|
+
end
|
30
45
|
end
|
31
46
|
end
|
32
47
|
|
data/spec/response_spec.rb
CHANGED
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe :response do
|
4
4
|
|
5
|
+
after(:all) { ShopifyAPI::Mock.reset }
|
6
|
+
|
5
7
|
describe "#new" do
|
6
8
|
before { @fixture = ShopifyAPI::Mock::Fixture.find :orders }
|
7
9
|
it "should cache the new response" do
|
@@ -12,7 +14,7 @@ describe :response do
|
|
12
14
|
end
|
13
15
|
|
14
16
|
describe "#all" do
|
15
|
-
subject { ShopifyAPI::Mock::
|
17
|
+
subject { ShopifyAPI::Mock::Response.all }
|
16
18
|
it { should be_kind_of Array }
|
17
19
|
end
|
18
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify-mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-08 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fakeweb
|
16
|
-
requirement: &
|
16
|
+
requirement: &11793040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11793040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &11792540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,18 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *11792540
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &11792060 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.8.7
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *11792060
|
36
47
|
description: ! 'This gem is used for testing Shopify apps without having to actually
|
37
48
|
connect to
|
38
49
|
|
@@ -59,34 +70,62 @@ files:
|
|
59
70
|
- lib/shopify-mock.rb
|
60
71
|
- lib/shopify-mock/errors.rb
|
61
72
|
- lib/shopify-mock/fixtures.rb
|
62
|
-
- lib/shopify-mock/fixtures/articles.json
|
63
|
-
- lib/shopify-mock/fixtures/assets.json
|
64
|
-
- lib/shopify-mock/fixtures/blogs.json
|
65
|
-
- lib/shopify-mock/fixtures/collect.json
|
66
|
-
- lib/shopify-mock/fixtures/comments.json
|
67
|
-
- lib/shopify-mock/fixtures/count.json
|
68
|
-
- lib/shopify-mock/fixtures/countries.json
|
69
|
-
- lib/shopify-mock/fixtures/custom_collections.json
|
70
|
-
- lib/shopify-mock/fixtures/customer_groups.json
|
71
|
-
- lib/shopify-mock/fixtures/customers.json
|
72
|
-
- lib/shopify-mock/fixtures/events.json
|
73
|
-
- lib/shopify-mock/fixtures/fulfillments.json
|
74
|
-
- lib/shopify-mock/fixtures/images.json
|
75
|
-
- lib/shopify-mock/fixtures/metafields.json
|
76
|
-
- lib/shopify-mock/fixtures/orders.json
|
77
|
-
- lib/shopify-mock/fixtures/pages.json
|
78
|
-
- lib/shopify-mock/fixtures/product_search_engines.json
|
79
|
-
- lib/shopify-mock/fixtures/products.json
|
80
|
-
- lib/shopify-mock/fixtures/provinces.json
|
81
|
-
- lib/shopify-mock/fixtures/redirects.json
|
82
|
-
- lib/shopify-mock/fixtures/script_tags.json
|
83
|
-
- lib/shopify-mock/fixtures/shop.json
|
84
|
-
- lib/shopify-mock/fixtures/smart_collections.json
|
85
|
-
- lib/shopify-mock/fixtures/test.json
|
86
|
-
- lib/shopify-mock/fixtures/themes.json
|
87
|
-
- lib/shopify-mock/fixtures/transactions.json
|
88
|
-
- lib/shopify-mock/fixtures/variants.json
|
89
|
-
- lib/shopify-mock/fixtures/webhooks.json
|
73
|
+
- lib/shopify-mock/fixtures/json/articles.json
|
74
|
+
- lib/shopify-mock/fixtures/json/assets.json
|
75
|
+
- lib/shopify-mock/fixtures/json/blogs.json
|
76
|
+
- lib/shopify-mock/fixtures/json/collect.json
|
77
|
+
- lib/shopify-mock/fixtures/json/comments.json
|
78
|
+
- lib/shopify-mock/fixtures/json/count.json
|
79
|
+
- lib/shopify-mock/fixtures/json/countries.json
|
80
|
+
- lib/shopify-mock/fixtures/json/custom_collections.json
|
81
|
+
- lib/shopify-mock/fixtures/json/customer_groups.json
|
82
|
+
- lib/shopify-mock/fixtures/json/customers.json
|
83
|
+
- lib/shopify-mock/fixtures/json/events.json
|
84
|
+
- lib/shopify-mock/fixtures/json/fulfillments.json
|
85
|
+
- lib/shopify-mock/fixtures/json/images.json
|
86
|
+
- lib/shopify-mock/fixtures/json/metafields.json
|
87
|
+
- lib/shopify-mock/fixtures/json/orders.json
|
88
|
+
- lib/shopify-mock/fixtures/json/pages.json
|
89
|
+
- lib/shopify-mock/fixtures/json/product_search_engines.json
|
90
|
+
- lib/shopify-mock/fixtures/json/products.json
|
91
|
+
- lib/shopify-mock/fixtures/json/provinces.json
|
92
|
+
- lib/shopify-mock/fixtures/json/redirects.json
|
93
|
+
- lib/shopify-mock/fixtures/json/script_tags.json
|
94
|
+
- lib/shopify-mock/fixtures/json/shop.json
|
95
|
+
- lib/shopify-mock/fixtures/json/smart_collections.json
|
96
|
+
- lib/shopify-mock/fixtures/json/test.json
|
97
|
+
- lib/shopify-mock/fixtures/json/themes.json
|
98
|
+
- lib/shopify-mock/fixtures/json/transactions.json
|
99
|
+
- lib/shopify-mock/fixtures/json/variants.json
|
100
|
+
- lib/shopify-mock/fixtures/json/webhooks.json
|
101
|
+
- lib/shopify-mock/fixtures/xml/articles.xml
|
102
|
+
- lib/shopify-mock/fixtures/xml/assets.xml
|
103
|
+
- lib/shopify-mock/fixtures/xml/blogs.xml
|
104
|
+
- lib/shopify-mock/fixtures/xml/collect.xml
|
105
|
+
- lib/shopify-mock/fixtures/xml/comments.xml
|
106
|
+
- lib/shopify-mock/fixtures/xml/count.xml
|
107
|
+
- lib/shopify-mock/fixtures/xml/countries.xml
|
108
|
+
- lib/shopify-mock/fixtures/xml/custom_collections.xml
|
109
|
+
- lib/shopify-mock/fixtures/xml/customer_groups.xml
|
110
|
+
- lib/shopify-mock/fixtures/xml/customers.xml
|
111
|
+
- lib/shopify-mock/fixtures/xml/events.xml
|
112
|
+
- lib/shopify-mock/fixtures/xml/fulfillments.xml
|
113
|
+
- lib/shopify-mock/fixtures/xml/images.xml
|
114
|
+
- lib/shopify-mock/fixtures/xml/metafields.xml
|
115
|
+
- lib/shopify-mock/fixtures/xml/orders.xml
|
116
|
+
- lib/shopify-mock/fixtures/xml/pages.xml
|
117
|
+
- lib/shopify-mock/fixtures/xml/product_search_engines.xml
|
118
|
+
- lib/shopify-mock/fixtures/xml/products.xml
|
119
|
+
- lib/shopify-mock/fixtures/xml/provinces.xml
|
120
|
+
- lib/shopify-mock/fixtures/xml/redirects.xml
|
121
|
+
- lib/shopify-mock/fixtures/xml/script_tags.xml
|
122
|
+
- lib/shopify-mock/fixtures/xml/shop.xml
|
123
|
+
- lib/shopify-mock/fixtures/xml/smart_collections.xml
|
124
|
+
- lib/shopify-mock/fixtures/xml/test.xml
|
125
|
+
- lib/shopify-mock/fixtures/xml/themes.xml
|
126
|
+
- lib/shopify-mock/fixtures/xml/transactions.xml
|
127
|
+
- lib/shopify-mock/fixtures/xml/variants.xml
|
128
|
+
- lib/shopify-mock/fixtures/xml/webhooks.xml
|
90
129
|
- lib/shopify-mock/response.rb
|
91
130
|
- lib/shopify-mock/urls.rb
|
92
131
|
- shopify-mock.gemspec
|