spec/page_rankr_spec.rb in PageRankr-2.0.1 vs spec/page_rankr_spec.rb in PageRankr-2.0.2

- old
+ new

@@ -20,11 +20,15 @@ it{ should include(:google) } end describe "#ranks" do describe "success" do - subject{ PageRankr.ranks("www.google.com") } + subject do + VCR.use_cassette(:success_ranks) do + PageRankr.ranks("www.google.com") + end + end it{ should have_key(:alexa_us) } it{ should have_key(:alexa_global) } it{ should have_key(:google) } it{ should have_key(:compete) } @@ -34,11 +38,15 @@ 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") } + subject do + VCR.use_cassette(:failure_ranks) do + PageRankr.ranks("please-dont-register-a-site-that-breaks-this-test.com") + end + end it{ should have_key(:alexa_us) } it{ should have_key(:alexa_global) } it{ should have_key(:google) } it{ should have_key(:compete) } @@ -59,20 +67,28 @@ it{ should include(:yahoo) } end describe "#backlinks" do describe "success" do - subject{ PageRankr.backlinks("www.google.com") } + subject do + VCR.use_cassette(:success_backlinks) do + PageRankr.backlinks("www.google.com") + end + end PageRankr.backlink_trackers.each do |tracker| it{ should have_key(tracker) } it{ subject[tracker].should > 0 } end end describe "failure" do - subject{ PageRankr.backlinks("please-dont-register-a-site-that-breaks-this-test.com") } + subject do + VCR.use_cassette(:failure_backlinks) do + PageRankr.backlinks("please-dont-register-a-site-that-breaks-this-test.com") + end + end PageRankr.backlink_trackers.each do |tracker| it{ should have_key(tracker) } it{ subject[tracker].should be_nil } end @@ -86,19 +102,27 @@ it{ should include(:bing) } end describe "#indexes" do describe "success" do - subject{ PageRankr.indexes("www.google.com") } + subject do + VCR.use_cassette(:success_indexes) do + PageRankr.indexes("www.google.com") + end + end PageRankr.index_trackers.each do |tracker| it{ should have_key(tracker) } it{ subject[tracker].should > 0 } end end describe "failure" do - subject{ PageRankr.indexes("please-dont-register-a-site-that-breaks-this-test.com") } + subject do + VCR.use_cassette(:failure_indexes) do + PageRankr.indexes("please-dont-register-a-site-that-breaks-this-test.com") + end + end PageRankr.index_trackers.each do |tracker| it{ should have_key(tracker) } it{ subject[tracker].should be_nil } end \ No newline at end of file