Sha256: 0b10d50cd72fb13d0ece73b9be17850066fecd16e44f3382268c6a5e55b2d51f

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shopify_api-3.2.4 test/variant_test.rb
shopify_api-3.2.3 test/variant_test.rb
shopify_api-3.2.2 test/variant_test.rb
shopify_api-3.2.1 test/variant_test.rb
shopify_api-3.2.0 test/variant_test.rb