Skip to content

Commit

Permalink
add admin/auction_helper specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Longhi committed Jun 30, 2010
1 parent 2dfe988 commit d6f2795
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/helpers/admin/auctions_helper_spec.rb
@@ -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

0 comments on commit d6f2795

Please sign in to comment.