test/pocket/article_test.rb in pocket-ruby-0.1.0 vs test/pocket/article_test.rb in pocket-ruby-0.2.0
- old
+ new
@@ -118,9 +118,31 @@
test "read_url" do
assert_equal "https://getpocket.com/read/229279689", article.read_url
end
+ test "tags" do
+ assert_equal ["my-tag-1", "my-tag-2"], article.tags
+ end
+
+ test "tags returns an empty array if there are no tags" do
+ parsed_response.delete("tags")
+ assert_equal [], article.tags
+ end
+
+ test "authors" do
+ result = article.authors
+ assert_equal 1, result.size
+ assert_equal "Stephen King", result.first.name
+ assert_equal 62344201, result.first.id
+ assert_equal "https://example.com/author", result.first.url
+ end
+
+ test "authors returns an empty array if there are no tags" do
+ parsed_response.delete("authors")
+ assert_equal [], article.authors
+ end
+
private
def article
@article ||= Pocket::Article.new(parsed_response)
end