Skip to content

Commit

Permalink
Bootstrapping helpers integration
Browse files Browse the repository at this point in the history
  • Loading branch information
alup committed Jun 16, 2012
1 parent a3426ca commit ea559cf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/money-rails/helpers/action_view_extension.rb
@@ -0,0 +1,8 @@
module MoneyRails
module ActionViewExtension

def currency_symbol
content_tag(:span, Money.default_currency.symbol, :class => "currency_symbol")
end
end
end
6 changes: 6 additions & 0 deletions lib/money-rails/hooks.rb
Expand Up @@ -18,6 +18,12 @@ def self.init
# Mongoid 3.x stuff here
end
end

# For ActionView
ActiveSupport.on_load(:action_view) do
require 'money-rails/helpers/action_view_extension'
::ActionView::Base.send :include, MoneyRails::ActionViewExtension
end
end
end
end
9 changes: 9 additions & 0 deletions spec/helpers/action_view_extension_spec.rb
@@ -0,0 +1,9 @@
require 'spec_helper'

describe 'MoneyRails::ActionViewExtension' do
describe '#currency_symbol' do
subject { helper.currency_symbol }
it { should be_a String }
it { should include Money.default_currency.symbol }
end
end

0 comments on commit ea559cf

Please sign in to comment.