Skip to content

Commit

Permalink
add an ibu helper to beers
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewshafer committed Apr 8, 2014
1 parent b5ed461 commit 8202b43
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/tankard/api/beers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def abv(beer_abv)
self
end

def ibu(beer_ibu)
@http_request_parameters.ibu = beer_ibu
self
end

# Page number to request
#
# @param number [Integer]
Expand Down
13 changes: 13 additions & 0 deletions spec/tankard/api/beers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@
end
end

describe '#ibu' do

it 'sets the http_request_parameters[:ibu] for the query' do
beers.ibu('30,50')
beers_options = beers.instance_variable_get(:"@http_request_parameters")
expect(beers_options[:ibu]).to eql('30,50')
end

it 'returns self' do
expect(beers.object_id).to eql(beers.ibu('+50').object_id)
end
end

describe '#page' do

it 'sets the http_request_parameters[:p] for the page number' do
Expand Down

0 comments on commit 8202b43

Please sign in to comment.