shopify-mock 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/lib/shopify-mock.rb +61 -7
- data/lib/shopify-mock/errors.rb +6 -0
- data/lib/shopify-mock/fixtures.rb +91 -26
- data/lib/shopify-mock/response.rb +34 -15
- data/lib/shopify-mock/urls.rb +2 -7
- data/shopify-mock.gemspec +1 -2
- data/spec/errors_spec.rb +5 -0
- data/spec/fixtures_spec.rb +44 -30
- data/spec/mock_spec.rb +49 -0
- data/spec/response_spec.rb +20 -23
- data/spec/support/http_support.rb +2 -2
- metadata +9 -7
- data/lib/shopify-mock/version.rb +0 -3
data/.gitignore
CHANGED
data/lib/shopify-mock.rb
CHANGED
@@ -1,44 +1,98 @@
|
|
1
1
|
require 'fakeweb'
|
2
2
|
|
3
|
-
require 'shopify-mock/
|
3
|
+
require 'shopify-mock/errors'
|
4
4
|
require 'shopify-mock/urls'
|
5
5
|
require 'shopify-mock/fixtures'
|
6
6
|
require 'shopify-mock/response'
|
7
7
|
|
8
|
+
# Mock is an extension for the ShopifyAPI
|
8
9
|
module ShopifyAPI
|
10
|
+
# the main module for managing the Shopify mocks
|
9
11
|
module Mock
|
10
12
|
class << self
|
11
|
-
|
13
|
+
# get the enabled state of ShopifyAPI::Mock
|
14
|
+
# @return [Boolean] true if enabled
|
15
|
+
# @example Check if ShopifyAPI::Mock is enabled
|
16
|
+
# ShopifyAPI::Mock.enabled # => true or false
|
17
|
+
# @api public
|
18
|
+
def enabled?
|
12
19
|
@enabled || false
|
13
20
|
end
|
14
21
|
|
22
|
+
# enable or disable ShopifyAPI::Mock
|
23
|
+
# @param [Boolean] value true to enable ShopifyAPI::Mock, false to disable
|
24
|
+
# @return [Boolean] true if enabled
|
25
|
+
# @example Enabling ShopifyAPI::Mock
|
26
|
+
# ShopifyAPI::Mock.enabled = true
|
27
|
+
# @api public
|
15
28
|
def enabled=(value=false)
|
16
29
|
return @enabled if value == @enabled
|
17
30
|
if value
|
18
31
|
#load File.expand_path("../shopify-mock/responses.rb", __FILE__)
|
19
|
-
ShopifyAPI::Mock
|
32
|
+
ShopifyAPI::Mock.register_fixed_responses
|
20
33
|
else
|
21
|
-
|
34
|
+
ShopifyAPI::Mock::Response.clear
|
22
35
|
end
|
23
36
|
@enabled = value
|
24
37
|
end
|
25
38
|
|
39
|
+
# resets the ShopifyAPI::Mocks back to their original state
|
40
|
+
# @return [Boolean] true when successful
|
41
|
+
# @example Reset the mocks
|
42
|
+
# ShopifyAPI::Mock.reset
|
43
|
+
# @raise [ShopifyAPI::Mock::DisabledError] Raised when trying to reset the mocks when they are disabled
|
44
|
+
# @api public
|
26
45
|
def reset
|
27
|
-
ShopifyAPI::Mock
|
28
|
-
|
46
|
+
raise ShopifyAPI::Mock::DisabledError, "cannot reset ShopifyAPI::Mock while it is disabled" \
|
47
|
+
unless ShopifyAPI::Mock.enabled?
|
48
|
+
self.class.register_fixed_responses
|
29
49
|
end
|
30
50
|
|
31
|
-
|
51
|
+
# gets the state of access to the real Internet
|
52
|
+
# @return [Boolean] false if all access to the Internet has been disabled
|
53
|
+
# @example Check if access has been disabled
|
54
|
+
# can_access_internet = Shopify::Mock.allow_internet
|
55
|
+
# @api public
|
56
|
+
def allow_internet?
|
32
57
|
@allow_internet || true
|
33
58
|
end
|
34
59
|
|
60
|
+
# enables or disables access to the real Internet
|
61
|
+
# @return [Boolean] status of real Internet access
|
62
|
+
# @example Turn off access to the Internet altogether
|
63
|
+
# Shopify::Mock.allow_internet = false
|
64
|
+
# @api public
|
35
65
|
def allow_internet=(state = true)
|
36
66
|
return @allow_internet if @allow_internet == state
|
37
67
|
@allow_internet = state
|
38
68
|
FakeWeb.allow_net_connect = @allow_internet
|
39
69
|
end
|
70
|
+
|
71
|
+
# registers all the fixed responses
|
72
|
+
# @return [Array] the responses that were registered
|
73
|
+
# @api private
|
74
|
+
def register_fixed_responses
|
75
|
+
ShopifyAPI::Mock::Response.clear
|
76
|
+
|
77
|
+
registered_responses = []
|
78
|
+
ShopifyAPI::Mock::Fixture.all.each do |fixture|
|
79
|
+
# register the count fixture for this resource
|
80
|
+
count_fixture = ShopifyAPI::Mock::Fixture.find(:count, fixture.ext.to_sym)
|
81
|
+
registered_responses << ShopifyAPI::Mock::Response.new(
|
82
|
+
:get, "#{fixture.name.to_s}/count.#{fixture.ext}",
|
83
|
+
count_fixture.data
|
84
|
+
)
|
85
|
+
# register the resource fixture
|
86
|
+
registered_responses << ShopifyAPI::Mock::Response.new(
|
87
|
+
:get, "#{fixture.name.to_s}.#{fixture.ext.to_s}",
|
88
|
+
fixture.data
|
89
|
+
)
|
90
|
+
end
|
91
|
+
registered_responses
|
92
|
+
end
|
40
93
|
end
|
41
94
|
end
|
42
95
|
end
|
43
96
|
|
97
|
+
# enable mocking in Rails test environments by default
|
44
98
|
ShopifyAPI::Mock.enabled = defined?(Rails) && Rails.env.test?
|
@@ -1,50 +1,115 @@
|
|
1
1
|
module ShopifyAPI
|
2
2
|
module Mock
|
3
|
-
|
3
|
+
|
4
|
+
# provides easy access to fixtures
|
5
|
+
class Fixture
|
6
|
+
@path = nil
|
4
7
|
@cache = {}
|
5
8
|
|
9
|
+
# creates a new instance of ShopifyAPI::Mock::Fixture
|
10
|
+
# @param [String] file_name The location of the file to load into the fixture
|
11
|
+
# @raise [IOError] Raised when file_name is invalid
|
12
|
+
# @api private
|
13
|
+
def initialize(file_name)
|
14
|
+
raise IOError, "File not found: #{file_name}" unless File.exists? file_name
|
15
|
+
@file_name = file_name
|
16
|
+
end
|
17
|
+
|
18
|
+
# gets the content of the fixture
|
19
|
+
# @return [String] the contents of the file, or @data if it was overwritten
|
20
|
+
# @example Create a fixture and read its contents
|
21
|
+
# fixture = ShopifyAPI::Fixture("./orders.xml")
|
22
|
+
# data = fixture.data # => the contents of "./orders.xml"
|
23
|
+
# @api public
|
24
|
+
def data
|
25
|
+
@data || File.read(@file_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
# gets the name of the fixture
|
29
|
+
# @return [Symbol] the the file name without the extension
|
30
|
+
# @example Load a fixture and get its name
|
31
|
+
# fixture = ShopifyAPI::Fixture("./orders.xml")
|
32
|
+
# name = fixture.name # => :orders
|
33
|
+
# @api public
|
34
|
+
def name
|
35
|
+
File.basename(@file_name, ".#{self.ext.to_s}").to_sym
|
36
|
+
end
|
37
|
+
|
38
|
+
# overrides the contents of the fixture
|
39
|
+
# @param [String] value The new value to use, or set to nil to reset to default
|
40
|
+
# @return The new contents of the fixture
|
41
|
+
# @example Override a the contents of a fixture
|
42
|
+
# fixture = ShopifyAPI::Fixture("./orders.xml")
|
43
|
+
# data = fixture.data # => the contents of "./orders.xml"
|
44
|
+
# fixture.data = "hello world"
|
45
|
+
# data = fixture.data # => "hello world"
|
46
|
+
# @api public
|
47
|
+
def data=(value)
|
48
|
+
@data = value
|
49
|
+
data
|
50
|
+
end
|
51
|
+
|
52
|
+
# gets the extension of the fixture
|
53
|
+
# @return [Symbol] The extension
|
54
|
+
# @example Create a new fixture and get its extension
|
55
|
+
# fixture = ShopifyAPI::Fixture("./orders.xml")
|
56
|
+
# ext = fixture.ext # => :xml
|
57
|
+
# @api public
|
58
|
+
def ext
|
59
|
+
File.extname(@file_name).gsub(".","").to_sym
|
60
|
+
end
|
61
|
+
|
6
62
|
class << self
|
7
|
-
|
63
|
+
# finds all the fixtures
|
64
|
+
# @return [Array, Fixture] an array of all the Fixtures
|
65
|
+
# @example Find all the fixtures
|
66
|
+
# ShopifyAPI::Mock::Fixture.all
|
67
|
+
# @api public
|
8
68
|
def all
|
9
|
-
Dir[File.join(ShopifyAPI::Mock::
|
10
|
-
File.basename(
|
69
|
+
Dir[File.join(ShopifyAPI::Mock::Fixture.path, "*")].map do |file_name|
|
70
|
+
fixture_name = File.basename(file_name)
|
71
|
+
@cache[fixture_name] ||= Fixture.new(file_name)
|
11
72
|
end
|
12
73
|
end
|
13
74
|
|
14
|
-
|
75
|
+
# finds a fixture by name
|
76
|
+
# @param [Symbol] name The name of the fixture
|
77
|
+
# @param [Symbol] ext The extension of the symbol - defaults to :json
|
78
|
+
# @return [ShopifyAPI::Mock::Fixture] The fixture or nil if not found
|
79
|
+
# @example Find the orders json fixture
|
80
|
+
# fixture = ShopifyAPI::Mock::Fixture.find :orders
|
81
|
+
# @example Find the orders xml fixture
|
82
|
+
# fixture = ShopifyAPI::Mock::Fixture.find :orders, :xml
|
83
|
+
# @api public
|
84
|
+
def find(name, ext = :json)
|
15
85
|
fixture_name = "#{name.to_s}.#{ext.to_s}"
|
16
|
-
|
17
|
-
|
18
|
-
@cache[fixture_name]
|
19
|
-
@cache[fixture_name]
|
20
|
-
end
|
21
|
-
|
22
|
-
def use(name, content)
|
23
|
-
name = "#{name}.json"
|
24
|
-
if content == :default
|
25
|
-
@cache.delete name if @cache.include? name
|
26
|
-
else
|
27
|
-
@cache[name] = content
|
28
|
-
end
|
29
|
-
ShopifyAPI::Mock.reset
|
86
|
+
file_name = File.join(self.path, fixture_name)
|
87
|
+
return nil unless File.exists? file_name
|
88
|
+
@cache[fixture_name] ||= Fixture.new(file_name)
|
30
89
|
end
|
31
90
|
|
91
|
+
# gets the current path to the fixtures
|
92
|
+
# @return [String] The fixtures path
|
93
|
+
# @example Get the fixtures path
|
94
|
+
# fixture_path = ShopifyAPI::Mock::Fixture.path
|
95
|
+
# @api public
|
32
96
|
def path
|
33
97
|
@path ||= File.expand_path("../fixtures/", __FILE__)
|
34
98
|
end
|
35
99
|
|
100
|
+
# sets the current fixtures path
|
101
|
+
# @param [String] value The new fixtures path
|
102
|
+
# @return [String] The new fixtures path
|
103
|
+
# @example Override the default fixtures path
|
104
|
+
# ShopifyAPI::Mock::Fixture.path = File.join(Rails.root, "spec", "fixtures", "shopify")
|
105
|
+
# @api public
|
36
106
|
def path=(value)
|
107
|
+
return @path if @path == value
|
37
108
|
@path = value
|
38
|
-
ShopifyAPI::Mock.reset
|
39
|
-
end
|
40
|
-
|
41
|
-
def reset
|
42
109
|
@cache = {}
|
43
|
-
@path = nil
|
44
|
-
ShopifyAPI::Mock::Responses.register_all
|
45
110
|
end
|
46
|
-
|
47
111
|
end
|
112
|
+
|
48
113
|
end
|
49
114
|
end
|
50
115
|
end
|
@@ -1,25 +1,44 @@
|
|
1
1
|
module ShopifyAPI
|
2
2
|
module Mock
|
3
|
+
# used to manage the mocked responses
|
3
4
|
class Response
|
5
|
+
# creates and registers a new mocked response
|
6
|
+
# @param [Symbol] method The method of the reponse. Can be one of [:put, :get, :post, :delete]
|
7
|
+
# @param [String] resource The path to the resource.
|
8
|
+
# @param [String] response The response to provide when that URL is called
|
9
|
+
# @return [FakeWeb] The FakeWeb object for the mocked response
|
10
|
+
# @example Registering a response to the path "/orders.count.xml" with the response "hello world"
|
11
|
+
# ShopifyAPI::Mock::Response.register :get, "orders/count.xml", "hello world"
|
12
|
+
# @api public
|
13
|
+
def initialize(method, resource, response)
|
14
|
+
@@responses += FakeWeb.register_uri(
|
15
|
+
method, /#{SHOPIFY_MOCK_SHOP_BASE_URL}#{resource}/,
|
16
|
+
:body => response
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
4
20
|
class << self
|
5
|
-
|
6
|
-
|
7
|
-
method, /#{SHOPIFY_MOCK_SHOP_BASE_URL}#{resource}/,
|
8
|
-
:body => response
|
9
|
-
)
|
10
|
-
end
|
21
|
+
# store for all registered responses
|
22
|
+
@@responses = []
|
11
23
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
)
|
20
|
-
end
|
24
|
+
# finds all the registered responses
|
25
|
+
# @return [Array, FakeWeb] all the FakeWeb registered responses
|
26
|
+
# @example List all the registered responses
|
27
|
+
# puts ShopifyAPI::Mock::Response.all
|
28
|
+
# @api public
|
29
|
+
def all
|
30
|
+
@@responses
|
21
31
|
end
|
22
32
|
|
33
|
+
# clears all the currently registered responses
|
34
|
+
# @return [Array] the registered responses after clearing (should be empty)
|
35
|
+
# @example Clearing all registered responses
|
36
|
+
# ShopifyAPI::Mock::Response.clear
|
37
|
+
# @api public
|
38
|
+
def clear
|
39
|
+
FakeWeb.clean_registry
|
40
|
+
@@responses = []
|
41
|
+
end
|
23
42
|
end
|
24
43
|
end
|
25
44
|
end
|
data/lib/shopify-mock/urls.rb
CHANGED
@@ -1,7 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
:api_key => "apikey",
|
4
|
-
:secret => "secret"
|
5
|
-
}
|
6
|
-
|
7
|
-
SHOPIFY_MOCK_SHOP_BASE_URL = "https://.*:.*@#{SHOPIFY_MOCK_SHOP[:domain]}/admin/"
|
1
|
+
# base URL used for registering mock responses
|
2
|
+
SHOPIFY_MOCK_SHOP_BASE_URL = "https://.*:.*@.*\.myshopify.com/admin/"
|
data/shopify-mock.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "shopify-mock/version"
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "shopify-mock"
|
7
|
-
s.version =
|
6
|
+
s.version = "0.1.0"
|
8
7
|
s.authors = ["Travis Haynes"]
|
9
8
|
s.email = ["travis.j.haynes@gmail.com"]
|
10
9
|
s.homepage = "https://github.com/travishaynes/shopify-mock"
|
data/spec/errors_spec.rb
ADDED
data/spec/fixtures_spec.rb
CHANGED
@@ -1,44 +1,58 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ShopifyAPI::Mock::
|
3
|
+
describe ShopifyAPI::Mock::Fixture do
|
4
4
|
|
5
|
-
describe "#
|
6
|
-
|
7
|
-
|
5
|
+
describe "#new" do
|
6
|
+
context "with invalid file name" do
|
7
|
+
it "should raise IOError" do
|
8
|
+
expect {ShopifyAPI::Mock::Fixture.new("invalid-file") }.should raise_error, IOError
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "with valid file name" do
|
13
|
+
before do
|
14
|
+
@file_name = File.expand_path("../../lib/shopify-mock/fixtures/orders.json", __FILE__)
|
15
|
+
@fixture = ShopifyAPI::Mock::Fixture.new(@file_name)
|
16
|
+
end
|
17
|
+
specify { @fixture.should be_a ShopifyAPI::Mock::Fixture }
|
8
18
|
end
|
9
19
|
end
|
10
20
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
21
|
+
describe "#all" do
|
22
|
+
before { @all = ShopifyAPI::Mock::Fixture.all }
|
23
|
+
specify { @all.should be_kind_of Array }
|
24
|
+
specify { @all.length.should > 0 }
|
16
25
|
end
|
17
26
|
|
18
|
-
|
19
|
-
|
20
|
-
|
27
|
+
describe "#find" do
|
28
|
+
context "with a valid fixture name" do
|
29
|
+
before { @result = ShopifyAPI::Mock::Fixture.find :orders, :json }
|
30
|
+
specify { @result.should be_kind_of ShopifyAPI::Mock::Fixture }
|
31
|
+
end
|
32
|
+
context "with an invalid fixture name" do
|
33
|
+
before { @result = ShopifyAPI::Mock::Fixture.find :brown_chicken_brown_cow, :xml }
|
34
|
+
specify { @result.should be_nil }
|
21
35
|
end
|
22
36
|
end
|
23
37
|
|
24
|
-
|
25
|
-
before { @
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
describe "#data" do
|
39
|
+
before { @fixture = ShopifyAPI::Mock::Fixture.find :orders, :json }
|
40
|
+
specify { @fixture.data.should_not be_empty }
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#data=" do
|
44
|
+
before(:all) do
|
45
|
+
@fixture = ShopifyAPI::Mock::Fixture.find :orders, :json
|
46
|
+
@original_data = @fixture.data
|
47
|
+
end
|
48
|
+
it "should override the original content" do
|
49
|
+
@fixture.data.should eq @original_data
|
50
|
+
@fixture.data = 'new'
|
51
|
+
@fixture.data.should eq 'new'
|
52
|
+
end
|
53
|
+
it "should reset to original content when set to nil" do
|
54
|
+
@fixture.data = nil
|
55
|
+
@fixture.data.should eq @original_data
|
42
56
|
end
|
43
57
|
end
|
44
58
|
|
data/spec/mock_spec.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ShopifyAPI::Mock do
|
4
|
+
|
5
|
+
describe "#enabled=" do
|
6
|
+
context "given true" do
|
7
|
+
before { ShopifyAPI::Mock.enabled = true }
|
8
|
+
it "should register a response for each fixtures * 2 for the count fixtures" do
|
9
|
+
ShopifyAPI::Mock::Response.all.count.should eq ShopifyAPI::Mock::Fixture.all.count * 2
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "given false" do
|
14
|
+
before { ShopifyAPI::Mock.enabled = false }
|
15
|
+
it "should clear all registered responses" do
|
16
|
+
ShopifyAPI::Mock::Response.all.should be_empty
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#reset" do
|
22
|
+
context "while ShopifyAPI::Mock is disabled" do
|
23
|
+
it "should raise DisabledError" do
|
24
|
+
ShopifyAPI::Mock.enabled = false
|
25
|
+
expect { ShopifyAPI::Mock.reset }.to raise_error ShopifyAPI::Mock::DisabledError
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "while ShopifyAPI::Mock is enabled" do
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#allow_internet=" do
|
34
|
+
context "given true" do
|
35
|
+
before { ShopifyAPI::Mock.allow_internet = true }
|
36
|
+
it "should allow Internet access" do
|
37
|
+
FakeWeb.allow_net_connect?.should eq true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "given false" do
|
42
|
+
before { ShopifyAPI::Mock.allow_internet = false }
|
43
|
+
it "should not allow Internet access" do
|
44
|
+
FakeWeb.allow_net_connect?.should eq false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/spec/response_spec.rb
CHANGED
@@ -2,30 +2,27 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe :response do
|
4
4
|
|
5
|
+
describe "#new" do
|
6
|
+
before { @fixture = ShopifyAPI::Mock::Fixture.find :orders }
|
7
|
+
it "should cache the new response" do
|
8
|
+
count = ShopifyAPI::Mock::Response.all.count
|
9
|
+
ShopifyAPI::Mock::Response.new(:get, "/orders.json", @fixture)
|
10
|
+
ShopifyAPI::Mock::Response.all.count.should eq count + 1
|
11
|
+
end
|
12
|
+
end
|
5
13
|
|
6
|
-
describe "all
|
7
|
-
ShopifyAPI::Mock::
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "GET /#{fixture}/count.json" do
|
20
|
-
before do
|
21
|
-
@json = read_fixture :count
|
22
|
-
@response = get [fixture, :count]
|
23
|
-
end
|
24
|
-
it "should return count json" do
|
25
|
-
@response.body.should eq @json
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
14
|
+
describe "#all" do
|
15
|
+
subject { ShopifyAPI::Mock::Fixture.all }
|
16
|
+
it { should be_kind_of Array }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#clear" do
|
20
|
+
it "should clear the responses" do
|
21
|
+
ShopifyAPI::Mock::Response.new(:get, "/orders.json", @fixture)
|
22
|
+
ShopifyAPI::Mock::Response.all.count.should > 0
|
23
|
+
ShopifyAPI::Mock::Response.clear
|
24
|
+
ShopifyAPI::Mock::Response.all.count.should eq 0
|
29
25
|
end
|
30
26
|
end
|
27
|
+
|
31
28
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
def get(path = [], options = {}, user =
|
1
|
+
def get(path = [], options = {}, user = "api_key", pass = "token")
|
2
2
|
path = parse_path(path)
|
3
3
|
options = parse_options(options)
|
4
4
|
path = "#{path}?#{options}" unless options.nil?
|
5
5
|
|
6
|
-
http = Net::HTTP.new(
|
6
|
+
http = Net::HTTP.new("test.myshopify.com", 443)
|
7
7
|
http.use_ssl = true
|
8
8
|
req = Net::HTTP::Get.new path
|
9
9
|
req.basic_auth user, pass
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
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: &12454820 !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: *12454820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &12454320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12454320
|
36
36
|
description: ! 'This gem is used for testing Shopify apps without having to actually
|
37
37
|
connect to
|
38
38
|
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- README.rdoc
|
58
58
|
- Rakefile
|
59
59
|
- lib/shopify-mock.rb
|
60
|
+
- lib/shopify-mock/errors.rb
|
60
61
|
- lib/shopify-mock/fixtures.rb
|
61
62
|
- lib/shopify-mock/fixtures/articles.json
|
62
63
|
- lib/shopify-mock/fixtures/assets.json
|
@@ -88,9 +89,10 @@ files:
|
|
88
89
|
- lib/shopify-mock/fixtures/webhooks.json
|
89
90
|
- lib/shopify-mock/response.rb
|
90
91
|
- lib/shopify-mock/urls.rb
|
91
|
-
- lib/shopify-mock/version.rb
|
92
92
|
- shopify-mock.gemspec
|
93
|
+
- spec/errors_spec.rb
|
93
94
|
- spec/fixtures_spec.rb
|
95
|
+
- spec/mock_spec.rb
|
94
96
|
- spec/response_spec.rb
|
95
97
|
- spec/spec_helper.rb
|
96
98
|
- spec/support/fixture_support.rb
|
data/lib/shopify-mock/version.rb
DELETED