Browse Source

Add Redirect tests

Julio Napurí 9 years ago
parent
commit
5ef17a0950
2 changed files with 16 additions and 0 deletions
  1. 7 0
      test/fixtures/redirect.json
  2. 9 0
      test/redirect_test.rb

+ 7 - 0
test/fixtures/redirect.json

@@ -0,0 +1,7 @@
+{
+  "redirect": {
+    "id": 979034150,
+    "path": "\/ipod",
+    "target": "\/pages\/itunes"
+  }
+}

+ 9 - 0
test/redirect_test.rb

@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class RedirectTest < Test::Unit::TestCase
+  test "#create should create a redirect" do
+    fake "redirects", :method => :post, :status => 201, :body => load_fixture('redirect')
+    redirect = ShopifyAPI::Redirect.create(:path => "/ipod", :target => "/pages/itunes")
+    assert_equal 979034150, redirect.id
+  end
+end