Browse Source

Add SmartCollection tests

Julio Napurí 9 years ago
parent
commit
13480cca2d
2 changed files with 25 additions and 0 deletions
  1. 16 0
      test/fixtures/smart_collection.json
  2. 9 0
      test/smart_collection_test.rb

+ 16 - 0
test/fixtures/smart_collection.json

@@ -0,0 +1,16 @@
+{
+  "smart_collection": {
+    "id": 1063001432,
+    "handle": "macbooks",
+    "title": "Macbooks",
+    "updated_at": "2016-03-17T16:57:03-04:00",
+    "body_html": null,
+    "published_at": null,
+    "sort_order": "alpha-asc",
+    "template_suffix": null,
+    "published_scope": "global",
+    "disjunctive": false,
+    "rules": [
+    ]
+  }
+}

+ 9 - 0
test/smart_collection_test.rb

@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class SmartCollectionTest < Test::Unit::TestCase
+  test "Smart Collection creation" do
+    fake "smart_collections", :method => :post, :status => 201, :body => load_fixture('smart_collection')
+    smart_collection = ShopifyAPI::SmartCollection.create(:title => "Macbooks", :published => false)
+    assert_equal 1063001432, smart_collection.id
+  end
+end