-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
391 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'test_helper' | ||
|
||
class SavePagesTest < ActiveSupport::TestCase | ||
|
||
setup do | ||
user = users(:ben) | ||
@entry = create_tweet_entry(user.feeds.first) | ||
end | ||
|
||
test "should build" do | ||
article_url = "https://9to5mac.com/2018/01/12/final-cut-pro-x-how-to-improve-slow-motion-in-your-projects-video/" | ||
url = "https://mercury.postlight.com/parser?url=#{article_url}" | ||
stub_request_file('parsed_page.json', url, headers: {"Content-Type" => "application/json; charset=utf-8"}) | ||
|
||
SavePages.new().perform(@entry.id) | ||
|
||
saved_pages = @entry.reload.data["saved_pages"] | ||
assert saved_pages.has_key?(article_url), "Entry should have saved page" | ||
page = saved_pages[article_url]["result"] | ||
|
||
%w{title author url date_published content domain}.each do |key| | ||
assert page.has_key?(key), "page is missing #{key}" | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.