2011-06-30 18:19:48 -04:00
|
|
|
require 'bundler/setup'
|
2013-01-16 21:36:56 -05:00
|
|
|
require 'draper'
|
2013-03-03 06:14:18 -05:00
|
|
|
require 'rails/version'
|
2013-01-18 11:40:57 -05:00
|
|
|
require 'action_controller'
|
|
|
|
require 'action_controller/test_case'
|
2013-01-16 21:36:56 -05:00
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.expect_with(:rspec) {|c| c.syntax = :expect}
|
|
|
|
config.order = :random
|
2015-03-09 17:51:50 -04:00
|
|
|
config.mock_with :rspec do |mocks|
|
|
|
|
mocks.yield_receiver_to_any_instance_implementation_blocks = true
|
|
|
|
end
|
2013-01-16 21:36:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
class Model; include Draper::Decoratable; end
|
|
|
|
|
|
|
|
class Product < Model; end
|
2013-11-10 12:02:34 -05:00
|
|
|
class SpecialProduct < Product; end
|
2015-03-27 00:07:17 -04:00
|
|
|
class Other < Model; end
|
2013-01-16 21:36:56 -05:00
|
|
|
class ProductDecorator < Draper::Decorator; end
|
|
|
|
class ProductsDecorator < Draper::CollectionDecorator; end
|
|
|
|
|
|
|
|
class ProductPresenter < Draper::Decorator; end
|
|
|
|
|
|
|
|
class OtherDecorator < Draper::Decorator; end
|
|
|
|
|
|
|
|
module Namespaced
|
|
|
|
class Product < Model; end
|
|
|
|
class ProductDecorator < Draper::Decorator; end
|
|
|
|
|
|
|
|
class OtherDecorator < Draper::Decorator; end
|
|
|
|
end
|
|
|
|
|
|
|
|
# After each example, revert changes made to the class
|
|
|
|
def protect_class(klass)
|
|
|
|
before { stub_const klass.name, Class.new(klass) }
|
|
|
|
end
|
2013-01-18 11:40:57 -05:00
|
|
|
|
|
|
|
def protect_module(mod)
|
|
|
|
before { stub_const mod.name, mod.dup }
|
|
|
|
end
|