Sha256: ce42abd29ce21840465fc3bb3282e7ab64479d21ad4494d0e6d204c99b2d5e87

Contents?: true

Size: 886 Bytes

Versions: 2

Compression:

Stored size: 886 Bytes

Contents

require 'test_helper'

class EmatrixDatabaseSearcherTest < ActiveSupport::TestCase

  setup do
    @database = QuickSearch::EmatrixDatabaseSearcher.new(HTTPClient.new, 'chemistry', 3)
  end

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

  vcr_test "should have raw result", 'searches', cassette: 'ematrix_database_chemistry' do
    raw_results = @database.search
    assert raw_results.is_a?(Nokogiri::XML::Document)
  end

  vcr_test "should have parsed results", 'searches', cassette: 'ematrix_database_chemistry' do
    @database.search
    parsed_results = @database.results
    assert parsed_results.first.title.include?('Encyclopedia of analytical chemistry')
    assert parsed_results.first.link.include?('proxying.lib.ncsu.edu')
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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