Sha256: 977ade41f83142d077438d3980a9b71d0498569f3253d85d16b7bd9da6229989

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe PageRankr do
  describe "#ranks" do
    # Alexa may sometimes return a result for the incorrect site and thus it is necessary to check if
    # the results returned are for the site we want.
    #
    # For example, slocourts.net returns results for ca.gov, presumably because www.slocourts.ca.gov redirects
    # to slocourts.net. Clearly something is wrong with how Alexa handles this case and so in the event this
    # happens we treat the results as if there were no results.
    describe "when Alexa returns results for the incorrect site" do
      subject do
        VCR.use_cassette(:alexa_ranks_edge_case_1, :record => :new_episodes) do
          PageRankr.ranks("http://slocourts.net", :alexa_us, :alexa_global, :alexa_country)
        end
      end
      
      it{ should have_key(:alexa_us) }
      it{ should have_key(:alexa_global) }
      it{ should have_key(:alexa_country) }
      it{ subject[:alexa_us].should be_nil }
      it{ subject[:alexa_global].should be_nil }
      it{ subject[:alexa_country].should be_nil }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
PageRankr-4.4.1 spec/edge_cases_spec.rb
PageRankr-4.4.0 spec/edge_cases_spec.rb
PageRankr-4.3.0 spec/edge_cases_spec.rb
PageRankr-4.2.1 spec/edge_cases_spec.rb
PageRankr-4.2.0 spec/edge_cases_spec.rb
PageRankr-4.1.1 spec/edge_cases_spec.rb
PageRankr-4.1.0 spec/edge_cases_spec.rb