spec/page_rankr_spec.rb in PageRankr-1.7.1 vs spec/page_rankr_spec.rb in PageRankr-2.0.0

- old
+ new

@@ -12,81 +12,71 @@ describe PageRankr do describe "#rank_trackers" do subject{ PageRankr.rank_trackers } - it{ should include(:alexa) } + it{ should include(:alexa_us) } + it{ should include(:alexa_global) } + it{ should include(:compete) } it{ should include(:google) } end describe "#ranks" do describe "success" do - subject{ PageRankr.ranks("google.com") } + subject{ PageRankr.ranks("www.google.com") } - it{ should have_key(:alexa) } + it{ should have_key(:alexa_us) } + it{ should have_key(:alexa_global) } it{ should have_key(:google) } + it{ should have_key(:compete) } - let(:alexa_rank) { subject[:alexa] } - it{ alexa_rank.should have_key(:us) } - it{ alexa_rank.should have_key(:global) } - - let(:alexa_us_rank) { alexa_rank[:us] } - it{ alexa_us_rank.should >= 1 } - let(:alexa_global_rank) { alexa_rank[:global] } - it{ alexa_global_rank.should >= 1 } - - let(:google_rank) { subject[:google] } - it{ google_rank.should be_in(0..10)} + it{ subject[:alexa_us].should >= 1 } + it{ subject[:alexa_global].should >= 1 } + it{ subject[:compete].should >= 1 } + it{ subject[:google].should be_in(0..10) } end describe "failure" do subject{ PageRankr.ranks("please-dont-register-a-site-that-breaks-this-test.com") } - it{ should have_key(:alexa) } + it{ should have_key(:alexa_us) } + it{ should have_key(:alexa_global) } it{ should have_key(:google) } - - let(:alexa_rank) { subject[:alexa] } - it{ alexa_rank.should have_key(:us) } - it{ alexa_rank.should have_key(:global) } + it{ should have_key(:compete) } - let(:alexa_us_rank) { alexa_rank[:us] } - it{ alexa_us_rank.should == 0 } - let(:alexa_global_rank) { alexa_rank[:global] } - it{ alexa_global_rank.should == 0 } - - let(:google_rank) { subject[:google] } - it{ google_rank.should == -1 } + it{ subject[:alexa_us].should be_nil } + it{ subject[:alexa_global].should be_nil } + it{ subject[:compete].should be_nil } + it{ subject[:google].should be_nil } end end describe "#backlink_trackers" do subject{ PageRankr.backlink_trackers } it{ should include(:alexa) } - it{ should include(:alltheweb) } - it{ should include(:altavista) } it{ should include(:bing) } it{ should include(:google) } it{ should include(:yahoo) } end describe "#backlinks" do describe "success" do - subject{ PageRankr.backlinks("google.com") } + subject{ PageRankr.backlinks("www.google.com") } PageRankr.backlink_trackers.each do |tracker| it{ should have_key(tracker) } - it{ subject[tracker].should >= 0 } + it{ subject[tracker].should > 0 } end end describe "failure" do subject{ PageRankr.backlinks("please-dont-register-a-site-that-breaks-this-test.com") } PageRankr.backlink_trackers.each do |tracker| it{ should have_key(tracker) } - it{ subject[tracker].should == 0 } + it{ subject[tracker].should be_nil } end end end describe "#index_trackers" do @@ -96,23 +86,23 @@ it{ should include(:bing) } end describe "#indexes" do describe "success" do - subject{ PageRankr.indexes("google.com") } + subject{ PageRankr.indexes("www.google.com") } PageRankr.index_trackers.each do |tracker| it{ should have_key(tracker) } - it{ subject[tracker].should >= 0 } + it{ subject[tracker].should > 0 } end end describe "failure" do subject{ PageRankr.indexes("please-dont-register-a-site-that-breaks-this-test.com") } PageRankr.index_trackers.each do |tracker| it{ should have_key(tracker) } - it{ subject[tracker].should == 0 } + it{ subject[tracker].should be_nil } end end end end \ No newline at end of file