Browse Source

Clean up blog tests

Consistancy in fixtures/fix the test
Lydia Krupp-Hunter 12 years ago
parent
commit
268fd0ef95
3 changed files with 17 additions and 4 deletions
  1. 2 2
      test/blog_test.rb
  2. 13 0
      test/fixtures/blog.json
  3. 2 2
      test/fixtures/blogs.json

+ 2 - 2
test/blog_test.rb

@@ -2,7 +2,7 @@ require 'test_helper'
 class BlogTest < Test::Unit::TestCase
   test "blog creation" do
     fake "blogs", :method => :post, :status => 202
-    ShopifyAPI::Blog.create(:title => "Test Blog")
-    assert_equal '{"blog":{"title":"Test Blog"}}', FakeWeb.last_request.body
+    blog = ShopifyAPI::Blog.new(:title => "Test Blog")
+    assert_equal "Test Blog", blog.title
   end
 end

+ 13 - 0
test/fixtures/blog.json

@@ -0,0 +1,13 @@
+{
+  "blog": {
+    "handle": "test-blog",
+    "created_at": "2012-01-10T17:45:19-05:00",
+    "title": "Test Blog",
+    "template_suffix": null,
+    "updated_at": "2012-01-10T17:45:19-05:00",
+    "feedburner_location": null,
+    "id": 1008414260,
+    "feedburner": null,
+    "commentable": "no"
+  }
+}

+ 2 - 2
test/fixtures/blogs.json

@@ -1,5 +1,5 @@
 {
-  "blog": {
+  "blogs": [{
     "handle": "test-blog",
     "created_at": "2012-01-10T17:45:19-05:00",
     "title": "Test Blog",
@@ -9,5 +9,5 @@
     "id": 1008414260,
     "feedburner": null,
     "commentable": "no"
-  }
+  }]
 }