Sha256: 3190406411b6f38c6e55df4c317793ab17cda1eef2f8041b94dbbd96e954586d

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

require 'test/unit'
require 'gscraper/search/query'

class QueryResult < Test::Unit::TestCase

  include GScraper

  def setup
    @query = Search::Query.new(:query => 'ruby')
  end

  def test_first_result
    result = @query.first_result

    assert_not_nil result, "The Query for 'ruby' has no first-result"
    assert_equal result.rank, 1, "The first result for the Query 'ruby' does not have the rank of 1"
  end

  def test_second_result
    result = @query.result_at(2)

    assert_not_nil result, "The Query for 'ruby' has no second-result"
    assert_equal result.rank, 2, "The second result for the Query 'ruby' does not have the rank of 2"
  end

  def teardown
    @query = nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gscraper-0.1.5 test/search/query_result.rb
gscraper-0.1.4 test/search/query_result.rb