Sha256: 07c541cedcf7abfd53d37da30bd7deb6d5c4c23715d0eaaafb8a97dd8d407d51

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

require 'test_helper'

class SmartSubjectsSearcherTest < ActiveSupport::TestCase

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

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

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

  vcr_test "should have parsed results", 'searches', cassette: 'smart_subjects_chemistry' do
    @subjects.search
    parsed_results = @subjects.results
    assert parsed_results.first.title.include?('Biochemistry')
    assert parsed_results.first.link.include?('subject=13')
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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