Sha256: a24fa797976f75bc7e5a7aa875e03aaae002ea17387b9d60d99cad8b3d17dc04

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

module Rails::Assist
  module UseMacro
    def use_orm orm
      class_eval do
        begin
          include "Rails::Assist::Orm::#{orm.to_s.camelize}".constantize
        rescue
          raise ArgumentError, "Unregistered ORM library: #{orm}"
        end
      end
    end
  
    def assist_with *types
      types.each{|type| use_helper type}
    end
    alias_method :load_helpers, :assist_with
    alias_method :use_helpers,  :assist_with
  
    def use_helper type
      class_eval do
        begin
          include "Rails::Assist::#{type.to_s.camelize}".constantize
        rescue
          raise ArgumentError, "Unregistered Rails3 helper library: #{type}"
        end
      end
    end 
    alias_method :load_helper, :use_helper
  end                         
end
                              
RSpec.configure do |config|
  config.extend(Rails::Assist::UseMacro) 
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails3_assist-0.2.4 lib/rails3_assist/rspec/macro.rb
rails3_assist-0.2.3 lib/rails3_assist/rspec/macro.rb
rails3_assist-0.2.2 lib/rails3_assist/rspec/macro.rb