Sha256: db2163fcc1f68780948c2a30edfe17d1b9e466a85ad6e6436f87f8ed4759321d

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class WebsiteSearcherTest < ActiveSupport::TestCase

  setup do
    @website = QuickSearch::WebsiteSearcher.new(HTTPClient.new, 'printing', 3)
  end

  test "should have http client, query, and per_page" do
    assert @website.http.is_a? HTTPClient
    assert @website.q == 'printing'
    assert_equal 3, @website.per_page
  end

  vcr_test "should have raw result", 'searches', cassette: 'website_printing' do
    raw_results = @website.search
    assert raw_results['responseHeader']
  end

  vcr_test "should have parsed results", 'searches', cassette: 'website_printing' do
    @website.search
    parsed_results = @website.results
    assert parsed_results.first.title.include?('Print')
  end

  # # FIXME: this test should be moved to a result set object
  # vcr_test "should have raw search results", "searches", cassette: 'printing' do
  #   summon = QuickSearch::SummonSearcher.new(HTTPClient.new, 'printing', 3)
  #   summon.search
  #   results = summon.results
  #   assert results.first.description.include?('Although we live in the digital age')
  # end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quick_search-core-0.0.1 test/searcher/website_test.rb
quick_search-core-0.0.1.test test/searcher/website_test.rb