-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
307e135
commit 01b629b
Showing
4 changed files
with
115 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'minitest/autorun' | ||
require 'mocha' | ||
|
||
require File.join(File.dirname(__FILE__), "..", | ||
"lib", "tumble_out") | ||
|
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,31 @@ | ||
require File.join(File.dirname(__FILE__), "..", | ||
"test_helper") | ||
|
||
class TestPost < MiniTest::Unit::TestCase | ||
def setup | ||
raw_data = open( | ||
File.join(File.dirname(__FILE__), "..", | ||
"assets", "sample.xml") | ||
) | ||
|
||
Net::HTTP.expects(:get). | ||
with(URI.parse("http://sample.tumblr.com/api/read")).returns raw_data | ||
contentizer = TumbleOut::Contentizer.new("sample.tumblr.com") | ||
@posts = contentizer.posts | ||
end | ||
|
||
def test_if_body_is_set | ||
assert @posts.all? { |p| | ||
!((p.body.nil? || p.body.empty?)) | ||
} | ||
end | ||
|
||
def test_whether_content_matches_type | ||
convo = @posts.find { |p| p.type == "conversation" } | ||
|
||
doc = Nokogiri::HTML(convo.body) | ||
ul = doc.search("ul[class=conversation]") | ||
assert_equal 1, ul.size | ||
assert_equal 4, ul.search("li").size | ||
end | ||
end |