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

Minitest Integration

Closes #207
This commit is contained in:
Ryan Cook 2012-05-17 19:02:59 -05:00 committed by Steve Klabnik
parent 28facfc04d
commit 09b8445269
2 changed files with 27 additions and 0 deletions

View file

@ -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)

View 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