Sha256: 2203f94d0e8ce03f2e9ab58f5756a0f09f71791fb81a78e148d46590908a3775
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
require 'helper' class TestTimesTopics < Test::Unit::TestCase context "TimesTopics" do context "not found" do setup do TimesTags.stubs(:search).returns({ "results"=>[], "filter"=>"(Per)", "num_results"=>0, "query"=>"Not found"}) @topic = TimesTopics.new("Not found") end should "page_exists?" do assert !@topic.page_exists? end should "url" do assert_nil @topic.url end should "related_result_urls" do assert @topic.related_result_urls.empty? end end context "result found" do setup do TimesTags.stubs(:search).returns({"results"=>["bin Laden, Osama (Per)"], "filter"=>"(Per)", "num_results"=>1, "query"=>"Osama Bin Laden"}) @topic = TimesTopics.new("Osama Bin Laden") end should "page_exists?" do assert @topic.page_exists? end should "url" do assert_equal "http://topics.nytimes.com/top/reference/timestopics/people/b/osama_bin_laden/index.html", @topic.url end should "related_result_urls" do assert @topic.related_result_urls.empty? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
times_topics-0.2.0 | test/test_times_topics.rb |
times_topics-0.1.0 | test/test_times_topics.rb |