Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@elle
Created April 16, 2014 00:48
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 elle/10793783 to your computer and use it in GitHub Desktop.
Save elle/10793783 to your computer and use it in GitHub Desktop.
# instead of debugger, you could use byebug gem
# and then you do not need to require debugger
group :development, :test do
gem 'minitest'
gem 'awesome_print'
gem 'capybara'
gem 'database_cleaner', '~> 1.0'
gem 'debugger'
gem 'factory_girl_rails'
gem 'hirb'
gem 'mailcatcher'
gem 'minitest-reporters'
end
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/spec'
require 'debugger'
require 'capybara/rails'
# require 'valid_attribute'
# Turn like output reporter. More options, check: http://rubydoc.info/gems/minitest-reporters/0.4.0/file/README.md
require 'minitest/reporters'
MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
# Require ruby files in support dir.
Dir[File.expand_path('test/support/*.rb')].each { |file| require file }
DatabaseCleaner.strategy = :truncation
class MiniTest::Spec
ActiveRecord::Migration.check_pending!
include FactoryGirl::Syntax::Methods
# minitest-matchers. so we can use: have_valid()
# include ValidAttribute::Method
before :each do
DatabaseCleaner.clean
end
def show(object, label=nil)
ap "#{label}:" if label
ap object
end
class << self
alias context describe
end
end
class HelperTest < MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActionView::TestCase::Behavior
register_spec_type(/Helper$/, self)
end
class IntegrationTest < MiniTest::Spec
include Rails.application.routes.url_helpers
include Capybara::DSL
register_spec_type(/integration$/, self)
before { setup_integration_env }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment