implement Instapaper::BookmarkList#each

This commit is contained in:
stve 2015-10-10 08:41:04 -04:00
parent 96490cc9db
commit e3f3f74d64
2 changed files with 16 additions and 0 deletions

View file

@ -12,5 +12,9 @@ module Instapaper
attribute :highlights, Array[Instapaper::Highlight]
attribute :delete_ids, Array[Integer]
end
def each
bookmarks.each { |bookmark| yield(bookmark) }
end
end
end

View file

@ -0,0 +1,12 @@
require 'spec_helper'
describe Instapaper::BookmarkList do
describe '#each' do
it 'yields a list of bookmarks' do
list = Instapaper::BookmarkList.new(JSON.parse(fixture('bookmarks_list.json').read))
list.each do |bookmark|
expect(bookmark).to be_an Instapaper::Bookmark
end
end
end
end