1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00
draper/spec/spec_helper.rb
Morgan Lieberthal f4bb26bd53 Updated all specs to RSpec 3.0 syntax
Change specs to use synax `expect(OBJECT).to EXPECTATION` rather that
`OBJECT.should`. Changed all `OBJECT.stub(METHOD)` to `allow(OBJECT).to
receive(:method)`

Change one-liners to use syntax: `it { is_expected.to XXX }` rather than
`it { should }`.
2015-08-27 01:08:59 -06:00

57 lines
1.4 KiB
Ruby
Executable file

require 'bundler/setup'
require 'draper'
require 'rails/version'
require 'action_controller'
require 'action_controller/test_case'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
mocks.yield_receiver_to_any_instance_implementation_blocks = true
end
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.disable_monkey_patching!
if config.files_to_run.one?
config.default_formatter = 'doc'
else
config.default_formatter = 'progress'
end
config.order = :random
Kernel.srand config.seed
end
class Model; include Draper::Decoratable; end
class Product < Model; end
class SpecialProduct < Product; end
class Other < Model; end
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
def protect_module(mod)
before { stub_const mod.name, mod.dup }
end