Sha256: 9df5a6669c1301600e1128b18f8d41fe400e9f569ca2715eaff4b12114a30a14

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

class CatalogSearcherTest < ActiveSupport::TestCase

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

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

  vcr_test "should have raw result", 'searches', cassette: 'catalog_printing' do
    raw_results = @catalog.search
    assert raw_results.children.first.name == 'searchResponse'
    #assert raw_results['searchResponse']
  end

  vcr_test "should have parsed results", 'searches', cassette: 'catalog_printing' do
    @catalog.search
    parsed_results = @catalog.results
    assert parsed_results.first.title.include?('Federal printing : overview and selected issues')
  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/catalog_test.rb
quick_search-core-0.0.1.test test/searcher/catalog_test.rb