|
@@ -8,6 +8,8 @@ class ShopTest < Test::Unit::TestCase
|
|
|
end
|
|
|
|
|
|
def test_current_should_return_current_shop
|
|
|
+ fake "shop"
|
|
|
+ @shop = ShopifyAPI::Shop.current
|
|
|
assert @shop.is_a?(ShopifyAPI::Shop)
|
|
|
assert_equal "Apple Computers", @shop.name
|
|
|
assert_equal "apple.myshopify.com", @shop.myshopify_domain
|
|
@@ -16,7 +18,19 @@ class ShopTest < Test::Unit::TestCase
|
|
|
assert_nil @shop.tax_shipping
|
|
|
end
|
|
|
|
|
|
+ def test_current_with_options_should_return_current_shop
|
|
|
+ fake "shop.json?fields%5B%5D=name&fields%5B%5D=myshopify_domain", :extension => false, :method => :get, :status => 201, :body => load_fixture('shop')
|
|
|
+
|
|
|
+ @shop = ShopifyAPI::Shop.current(params: { fields: [:name, :myshopify_domain]})
|
|
|
+ assert @shop.is_a?(ShopifyAPI::Shop)
|
|
|
+ assert_equal "Apple Computers", @shop.name
|
|
|
+ assert_equal "apple.myshopify.com", @shop.myshopify_domain
|
|
|
+ end
|
|
|
+
|
|
|
def test_get_metafields_for_shop
|
|
|
+ fake "shop"
|
|
|
+ @shop = ShopifyAPI::Shop.current
|
|
|
+
|
|
|
fake "metafields"
|
|
|
|
|
|
metafields = @shop.metafields
|
|
@@ -26,6 +40,9 @@ class ShopTest < Test::Unit::TestCase
|
|
|
end
|
|
|
|
|
|
def test_add_metafield
|
|
|
+ fake "shop"
|
|
|
+ @shop = ShopifyAPI::Shop.current
|
|
|
+
|
|
|
fake "metafields", :method => :post, :status => 201, :body =>load_fixture('metafield')
|
|
|
|
|
|
field = @shop.add_metafield(ShopifyAPI::Metafield.new(:namespace => "contact", :key => "email", :value => "123@example.com", :value_type => "string"))
|
|
@@ -37,6 +54,9 @@ class ShopTest < Test::Unit::TestCase
|
|
|
end
|
|
|
|
|
|
def test_events
|
|
|
+ fake "shop"
|
|
|
+ @shop = ShopifyAPI::Shop.current
|
|
|
+
|
|
|
fake "events"
|
|
|
|
|
|
events = @shop.events
|