Skip to content

Commit

Permalink
rename to display_catarse_tax and more test
Browse files Browse the repository at this point in the history
  • Loading branch information
devton committed Oct 6, 2011
1 parent 826f28d commit 493b136
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/backer.rb
Expand Up @@ -53,13 +53,13 @@ def should_not_back_if_maximum_backers_been_reached
errors.add(:reward, I18n.t('backer.should_not_back_if_maximum_backers_been_reached')) unless reward.backers.confirmed.count < reward.maximum_backers
end
def display_value
number_to_currency value, :unit => "R$ ", :precision => 0, :delimiter => '.'
number_to_currency value, :unit => "R$", :precision => 0, :delimiter => '.'
end
def display_confirmed_at
I18n.l(confirmed_at.to_date) if confirmed_at
end
def display_moip_tax(tax=7.5)
number_to_currency ((value*tax)/100), :unit => "R$ ", :precision => 2, :delimiter => '.'
def display_catarse_tax(tax=7.5)
number_to_currency ((value*tax)/100), :unit => "R$", :precision => 2, :delimiter => '.'
end
def moip_value
"%0.0f" % (value * 100)
Expand Down
14 changes: 14 additions & 0 deletions spec/models/backer_spec.rb
Expand Up @@ -95,6 +95,20 @@
backer = Factory(:backer)
backer.payment_method.should == 'MoIP'
end

describe "#display_catarse_tax" do
before(:each) do
@backer = create(:backer, :value => 100)
end

it 'with default tax 7.5%'do
@backer.display_catarse_tax.should == 'R$ 7,50'
end

it 'with another tax'do
@backer.display_catarse_tax(5).should == 'R$ 5,00'
end
end
end

# == Schema Information
Expand Down

0 comments on commit 493b136

Please sign in to comment.