article_test.rb 965 B

12345678910111213141516171819202122232425262728
  1. require 'test_helper'
  2. class ArticleTest < Test::Unit::TestCase
  3. def test_get_article
  4. fake "articles/6242736", :method => :get, :body => load_fixture('article')
  5. article = ShopifyAPI::Article.find(6242736)
  6. assert_equal "First Post", article.title
  7. end
  8. def test_get_articles
  9. fake "articles", :method => :get, :body => load_fixture('articles')
  10. articles = ShopifyAPI::Article.all
  11. assert_equal 3, articles.length
  12. end
  13. def test_get_articles_namespaced
  14. fake "blogs/1008414260/articles", :method => :get, :body => load_fixture('articles')
  15. articles = ShopifyAPI::Article.find(:all, :params => {:blog_id => 1008414260})
  16. assert_equal 3, articles.length
  17. end
  18. def test_get_article_namespaced
  19. fake "blogs/1008414260/articles/6242736", :method => :get, :body => load_fixture('article')
  20. article = ShopifyAPI::Article.find(6242736, :params => {:blog_id => 1008414260})
  21. assert_equal "First Post", article.title
  22. end
  23. end