mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00

* Use the new `expect().to` syntax * Avoid general fixtures by minimizing usage of `let` and `subject` * Define as few support classes as possible, and use them for name lookup only - all behavior is introduced by stubbing
30 lines
784 B
Ruby
Executable file
30 lines
784 B
Ruby
Executable file
require 'bundler/setup'
|
|
require 'draper'
|
|
|
|
RSpec.configure do |config|
|
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
config.expect_with(:rspec) {|c| c.syntax = :expect}
|
|
config.order = :random
|
|
end
|
|
|
|
class Model; include Draper::Decoratable; end
|
|
|
|
class Product < 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
|