Created
March 7, 2012 19:54
-
-
Save farnoy/1995621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestSumthin < Okonski::Tests::ControllerCase | |
tests PostsController | |
def test_index | |
get :index | |
assert_response :success | |
assert_template :index | |
refute_empty assigns(:posts) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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