Module: RSpec::ActionView::Macro

Defined in:
lib/rspec-action_view/rspec/macro.rb

Instance Method Summary collapse

Instance Method Details

#extend_view_with(base_name, *modules) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec-action_view/rspec/macro.rb', line 8

def extend_view_with base_name, *modules
  modules = modules.flatten 
  Rails3::Plugin::Extender.new do
    # extend action_view with methods from some modules
    extend_rails :view do |v|   
      if base_name.kind_of?(Module) && !modules.empty? && modules.only_kinds_of?(Symbol)
        v.extend_from_module(base_name, *modules) 
      else
        v.extend_with base_name, *modules
      end
    end
  end
end