Skip to content

Instantly share code, notes, and snippets.

@cookrn
Created May 18, 2012 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cookrn/2722446 to your computer and use it in GitHub Desktop.
Save cookrn/2722446 to your computer and use it in GitHub Desktop.
Changes that allow the Draper MiniTest/Integration tests to pass
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
@cookrn
Copy link
Author

cookrn commented May 18, 2012

Updated to change MiniTest::Spec::Decorator to MiniTest::DecoratorSpec

@cookrn
Copy link
Author

cookrn commented May 18, 2012

@steveklabnik
Copy link

Are the requires actually required?

@steveklabnik
Copy link

@steveklabnik
Copy link

Oh, duh, minitest is always included in 1.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment