Sha256: 6526d313de3d20c3c5c65e636d7e4a2491063556ead471a0226b463097912fc9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

class TermExtractionTest < Test::Unit::TestCase
  should 'return correct terms from Yahoo!' do
    yahoo = TermExtraction::Yahoo.new
    yahoo.stubs(:remote_xml).returns(read_xml_fixture('yahoo'))
    assert_equal yahoo.terms, correct_yahoo_terms
  end
  
  should 'return correct terms from Zemanta' do
    zemanta = TermExtraction::Zemanta.new
    zemanta.stubs(:remote_xml).returns(read_xml_fixture('zemanta'))
    assert_equal zemanta.terms, correct_zemanta_terms
  end

  should 'be able to set the context after initialization' do
    yahoo         = TermExtraction::Yahoo.new
    context       = 'foo'
    yahoo.context = context
    assert_equal yahoo.context, context
  end

  should 'be able to set the api key after initialization' do
    zemanta         = TermExtraction::Zemanta.new
    context         = 'bar'
    zemanta.context = context
    assert_equal zemanta.context, context
  end

  private
    def correct_yahoo_terms
      ['gears of war', 'gears']
    end

    def correct_zemanta_terms
      ['Apple', 'IMac', 'Rumor', 'Hardware', 'Nvidia', 'Macintosh', 'Desktops', 'AllInOne']
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alexrabarts-term_extraction-0.1.1 test/term_extraction_test.rb