mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
parent
28facfc04d
commit
09b8445269
2 changed files with 27 additions and 0 deletions
|
@ -10,5 +10,6 @@ require 'draper/helper_support'
|
|||
require 'draper/view_context'
|
||||
require 'draper/decorated_enumerable_proxy'
|
||||
require 'draper/rspec_integration' if defined?(RSpec) and RSpec.respond_to?(:configure)
|
||||
require 'draper/minitest_integration'
|
||||
require 'draper/railtie' if defined?(Rails)
|
||||
|
||||
|
|
26
lib/draper/minitest_integration.rb
Executable file
26
lib/draper/minitest_integration.rb
Executable file
|
@ -0,0 +1,26 @@
|
|||
require 'minitest/unit'
|
||||
require 'minitest/spec'
|
||||
|
||||
module MiniTest
|
||||
class DecoratorSpec < Spec
|
||||
before do
|
||||
ApplicationController.new.set_current_view_context
|
||||
Draper::ViewContext.current.controller.request ||= ActionController::TestRequest.new
|
||||
Draper::ViewContext.current.request ||= Draper::ViewContext.current.controller.request
|
||||
Draper::ViewContext.current.params ||= {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class MiniTest::Unit::DecoratorTestCase < MiniTest::Unit::TestCase
|
||||
add_setup_hook do
|
||||
ApplicationController.new.set_current_view_context
|
||||
Draper::ViewContext.current.controller.request ||= ActionController::TestRequest.new
|
||||
Draper::ViewContext.current.request ||= Draper::ViewContext.current.controller.request
|
||||
Draper::ViewContext.current.params ||= {}
|
||||
end
|
||||
end
|
||||
|
||||
MiniTest::Spec.register_spec_type(MiniTest::DecoratorSpec) do |desc|
|
||||
desc.superclass == Draper::Base
|
||||
end
|
Loading…
Reference in a new issue