Skip to content

Instantly share code, notes, and snippets.

@farnoy
Created March 7, 2012 19:54
Show Gist options
  • Save farnoy/1995621 to your computer and use it in GitHub Desktop.
Save farnoy/1995621 to your computer and use it in GitHub Desktop.
task :minitest do
path = File.expand_path('test', Rails.root)
require File.expand_path('test_helper', path)
Dir[path + '/*_test.rb'].each do |file|
require file
end
end
class TestSumthin < Okonski::Tests::ControllerCase
tests PostsController
def test_index
get :index
assert_response :success
assert_template :index
refute_empty assigns(:posts)
end
end
require 'minitest/autorun'
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'active_support/testing/setup_and_teardown.rb'
module Okonski
module Tests
class Case < MiniTest::Unit::TestCase
include ActiveSupport::Testing::SetupAndTeardown
include ActiveSupport::Testing::SetupAndTeardown::ForMiniTest
def build_message(head, template=nil, *arguments)
template &&= template.chomp
template.gsub(/\?/) { mu_pp(arguments.shift) }
end
end
class ControllerCase < Case
include Rails.application.routes.url_helpers
include ActionController::TestCase::Behavior
def setup
@routes = Rails.application.routes
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment