Sha256: e2bb879ed714a5d2e0d367d5b6b790761623528f1937c86e6ced6fa53b818a81

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

require 'simplecov'
SimpleCov.start

require 'batch_actions'

class TestModel
  def self.where(query)
    query[:id].map { self.new }
  end
end

class TestModel2
  def self.where(query)
    query[:id].map { self.new }
  end
end

module InheritedResources
  class Base
    def self.resource_class
      TestModel
    end
  end
end

def mock_controller(params = {}, &block)
  parent = params.delete(:parent) || Object

  mock_class = Class.new(parent) do
    include BatchActions

    def params
      self.class.instance_variable_get :@params
    end
  end

  mock_class.class_exec(&block)
  mock_class.instance_variable_set :@params, params

  mock_class.new
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
batch_actions-0.0.1 spec/spec_helper.rb