Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrea Longhi
committed
Jun 30, 2010
1 parent
2dfe988
commit d6f2795
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
include ActionController::Streaming | ||
|
||
describe Admin::AuctionsHelper do | ||
describe 'FINAL_PRICE_STRING' do | ||
it 'should return nil when final_price is not set' do | ||
auction = mock(Auction, :final_price => nil) | ||
helper.final_price_string(auction).should be_nil | ||
end | ||
|
||
it 'should return a price string with currency and 2 decimals' do | ||
auction = mock_model(Auction, :final_price => 10.2, :currency_id => 'Euro') | ||
helper.final_price_string(auction).should == 'Euro 10.20' | ||
end | ||
end | ||
|
||
describe 'RESULTS_FOR' do | ||
it 'should return "no bids" when auction has no final price' do | ||
auction = mock(Auction, :final_price => nil) | ||
helper.results_for(auction).should == 'no bids' | ||
end | ||
|
||
it 'should return final_price_string when auction has a final price' do | ||
auction = mock_model(Auction, :final_price => 10.2, :currency_id => 'Euro') | ||
helper.results_for(auction).should == helper.final_price_string(auction) | ||
end | ||
end | ||
end |