Sha256: 836f1cb83175a2edb6fc611e66f6b66134c3288513b5731a0010a70ece413f08

Contents?: true

Size: 1.48 KB

Versions: 36

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'

class VariantTest < Test::Unit::TestCase

  def test_get_variants
    fake "products/632910392/variants", :method => :get, :body => load_fixture('variants')

    v = ShopifyAPI::Variant.find(:all, :params => {:product_id => 632910392})
  end

  def test_get_variant_namespaced
    fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')

    v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
  end

  def test_get_variant
    fake "variants/808950810", :method => :get, :body => load_fixture('variant')

    v = ShopifyAPI::Variant.find(808950810)
  end

  def test_product_id_should_be_accessible_if_via_product_endpoint
    fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')

    v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
    assert_equal 632910392, v.product_id
  end

  def test_product_id_should_be_accessible_if_via_variant_endpoint
    fake "variants/808950810", :method => :get, :body => load_fixture('variant')

    v = ShopifyAPI::Variant.find(808950810)
    assert_equal 632910392, v.product_id
  end

  def test_delete_variant
    fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
    fake "products/632910392/variants/808950810", :method => :delete, :body => 'destroyed'
    v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
    assert v.destroy
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
shopify_api-4.11.0 test/variant_test.rb
shopify_api-4.10.0 test/variant_test.rb
shopify_api-4.9.1 test/variant_test.rb
shopify_api-4.9.0 test/variant_test.rb
shopify_api-4.8.0 test/variant_test.rb
shopify_api-4.7.1 test/variant_test.rb
shopify_api-4.7.0 test/variant_test.rb
shopify_api-4.6.0 test/variant_test.rb
shopify_api-4.5.0 test/variant_test.rb
shopify_api-4.4.0 test/variant_test.rb
shopify_api-4.3.9 test/variant_test.rb
shopify_api-4.3.8 test/variant_test.rb
shopify_api-4.3.7 test/variant_test.rb
shopify_api-4.3.6 test/variant_test.rb
shopify_api-4.3.5 test/variant_test.rb
shopify_api-4.3.4 test/variant_test.rb
shopify_api-4.3.3 test/variant_test.rb
shopify_api-4.3.2 test/variant_test.rb
shopify_api-4.3.1 test/variant_test.rb
shopify_api-4.3.0 test/variant_test.rb