Jelajahi Sumber

Fix articles tests

Lydia Krupp-Hunter 12 tahun lalu
induk
melakukan
564ee7529a
2 mengubah file dengan 20 tambahan dan 5 penghapusan
  1. 5 5
      test/article_test.rb
  2. 15 0
      test/fixtures/article.json

+ 5 - 5
test/article_test.rb

@@ -9,20 +9,20 @@ class ArticleTest < Test::Unit::TestCase
   end
 
   def test_get_articles
-    fake "articles", :method => :get, :body => load_fixture('article')
+    fake "articles", :method => :get, :body => load_fixture('articles')
     articles = ShopifyAPI::Article.all
-    asert_equal 3, articles.length
+    assert_equal 3, articles.length
   end
 
   def test_get_articles_namespaced
-    fake "blogs/1008414260/articles", :method => :get, :body => load_fixture('article')
+    fake "blogs/1008414260/articles", :method => :get, :body => load_fixture('articles')
     articles = ShopifyAPI::Article.find(:all, :params => {:blog_id => 1008414260})
-    asert_equal 3, articles.length
+    assert_equal 3, articles.length
   end
 
   def test_get_article_namespaced
     fake "blogs/1008414260/articles/6242736", :method => :get, :body => load_fixture('article')
-    articles = ShopifyAPI::Article.find(6242736, :params => {:blog_id => 1008414260})
+    article = ShopifyAPI::Article.find(6242736, :params => {:blog_id => 1008414260})
     assert_equal "First Post", article.title
   end
 end

+ 15 - 0
test/fixtures/article.json

@@ -0,0 +1,15 @@
+{
+  "article": {
+    "author": "Shopify",
+    "blog_id": 1008414260,
+    "body_html": null,
+    "created_at": "2012-07-06T13:57:28-04:00",
+    "id": 6242736,
+    "published_at": "2012-07-06T13:57:28-04:00",
+    "summary_html": null,
+    "title": "First Post",
+    "updated_at": "2012-07-06T13:57:51-04:00",
+    "user_id": null,
+    "tags": "consequuntur, cupiditate, repellendus"
+  }
+}