Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MiniTest::Spec with Rails setup
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
require 'capybara/rails'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join( Rails.root, 'test', 'fixtures' )
end
class ControllerSpec < MiniTest::Spec
include Rails.application.routes.url_helpers
include ActionController::TestCase::Behavior
class << self
alias :context :describe
end
before do
@routes = Rails.application.routes
end
end
# Functional tests = describe ***Controller
MiniTest::Spec.register_spec_type( /Controller$/, ControllerSpec )
class AcceptanceSpec < MiniTest::Spec
include Rails.application.routes.url_helpers
include Capybara::DSL
before do
@routes = Rails.application.routes
end
end
# Integration/Acceptance tests = describe '*** Integration'
MiniTest::Spec.register_spec_type( /Integration$/, AcceptanceSpec )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment