alexrabarts-term_extraction 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 1
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 0
@@ -1,4 +1,6 @@
1
1
  class TermExtraction
2
+ attr_accessor :context, :api_key
3
+
2
4
  def initialize(options={})
3
5
  @context = options[:context]
4
6
  @api_key = options[:api_key]
@@ -4,12 +4,35 @@ class TermExtractionTest < Test::Unit::TestCase
4
4
  should 'return correct terms from Yahoo!' do
5
5
  yahoo = TermExtraction::Yahoo.new
6
6
  yahoo.stubs(:remote_xml).returns(read_xml_fixture('yahoo'))
7
- assert_equal yahoo.terms, ['gears of war', 'gears']
7
+ assert_equal yahoo.terms, correct_yahoo_terms
8
8
  end
9
9
 
10
10
  should 'return correct terms from Zemanta' do
11
11
  zemanta = TermExtraction::Zemanta.new
12
12
  zemanta.stubs(:remote_xml).returns(read_xml_fixture('zemanta'))
13
- assert_equal zemanta.terms, ['Apple', 'IMac', 'Rumor', 'Hardware', 'Nvidia', 'Macintosh', 'Desktops', 'AllInOne']
13
+ assert_equal zemanta.terms, correct_zemanta_terms
14
14
  end
15
+
16
+ should 'be able to set the context after initialization' do
17
+ yahoo = TermExtraction::Yahoo.new
18
+ context = 'foo'
19
+ yahoo.context = context
20
+ assert_equal yahoo.context, context
21
+ end
22
+
23
+ should 'be able to set the api key after initialization' do
24
+ zemanta = TermExtraction::Zemanta.new
25
+ context = 'bar'
26
+ zemanta.context = context
27
+ assert_equal zemanta.context, context
28
+ end
29
+
30
+ private
31
+ def correct_yahoo_terms
32
+ ['gears of war', 'gears']
33
+ end
34
+
35
+ def correct_zemanta_terms
36
+ ['Apple', 'IMac', 'Rumor', 'Hardware', 'Nvidia', 'Macintosh', 'Desktops', 'AllInOne']
37
+ end
15
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexrabarts-term_extraction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - alex
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-27 00:00:00 -08:00
12
+ date: 2009-03-05 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency