variant_test.rb 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. require 'test_helper'
  2. class VariantTest < Test::Unit::TestCase
  3. def test_get_variants
  4. fake "products/632910392/variants", :method => :get, :body => load_fixture('variants')
  5. v = ShopifyAPI::Variant.find(:all, :params => {:product_id => 632910392})
  6. end
  7. def test_get_variant_namespaced
  8. fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
  9. v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
  10. end
  11. def test_get_variant
  12. fake "variants/808950810", :method => :get, :body => load_fixture('variant')
  13. v = ShopifyAPI::Variant.find(808950810)
  14. end
  15. def test_product_id_should_be_accessible_if_via_product_endpoint
  16. fake "products/632910392/variants/808950810", :method => :get, :body => load_fixture('variant')
  17. v = ShopifyAPI::Variant.find(808950810, :params => {:product_id => 632910392})
  18. assert_equal 632910392, v.product_id
  19. end
  20. def test_product_id_should_be_accessible_if_via_variant_endpoint
  21. fake "variants/808950810", :method => :get, :body => load_fixture('variant')
  22. v = ShopifyAPI::Variant.find(808950810)
  23. assert_equal 632910392, v.product_id
  24. end
  25. end