Skip to content

Commit

Permalink
Merge pull request #5 from yegor256/master
Browse files Browse the repository at this point in the history
#4 renamed total to totalResults
  • Loading branch information
le0pard committed Mar 15, 2014
2 parents 494dcfe + 8480626 commit 6a3fe39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Readme.textile
Expand Up @@ -20,6 +20,6 @@ h3. Example
<pre><code>require 'indeed'
Indeed.key = &lt;publisher key&gt;
result = Indeed.search(:q => "ruby", :l => "Boston")
result.total #indeed returns number of results
result.totalResults #indeed returns number of results
Indeed.get('f8abbe5539f14420', '4fb26405a44d7eb8')
</code></pre>
4 changes: 2 additions & 2 deletions lib/indeed.rb
Expand Up @@ -106,11 +106,11 @@ def format_log_entry(message, dump = nil)

class IndeedResult < Array

attr_accessor :total
attr_accessor :totalResults

def initialize(array, total)
super(array)
self.total = total
self.totalResults = total
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/indeed_spec.rb
Expand Up @@ -44,12 +44,12 @@

describe ".search" do
subject { Indeed.search(:q => "Java", :l => "Boston") }

it { should be_a(Array) }

it {should_not be_empty }
it "should get total number of results from indeed" do
subject.total.should == 822
it "should get total number of results from indeed" do
subject.totalResults.should == 822
end
end

Expand All @@ -61,7 +61,7 @@

context "when Indeed returns html instead of json" do
before(:each) do

Net::HTTP.stubs(:get).returns(<<-HTML)
<h1>Internal Error</h1>
HTML
Expand All @@ -72,6 +72,6 @@
Indeed.search({})
}.should raise_error(IndeedError)
end

end
end

0 comments on commit 6a3fe39

Please sign in to comment.