Skip to content

Instantly share code, notes, and snippets.

@cookrn
Created May 18, 2012 00:31
Show Gist options
  • Select an option

  • Save cookrn/2722446 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown
Author

cookrn commented May 18, 2012

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

@cookrn
Copy link
Copy Markdown
Author

cookrn commented May 18, 2012

@steveklabnik
Copy link
Copy Markdown

Are the requires actually required?

@steveklabnik
Copy link
Copy Markdown

@steveklabnik
Copy link
Copy Markdown

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