Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2013 15:09
Show Gist options
  • Save anonymous/5005310 to your computer and use it in GitHub Desktop.
Save anonymous/5005310 to your computer and use it in GitHub Desktop.
My minimum Gemfile needs for MiniTest
FactoryGirl.define do
factory :object do
end
end
group :development, :test do
gem 'sqlite3'
gem 'trinidad', :platform => :jruby
gem 'unicorn', :platform => :ruby
gem 'better_errors'
gem 'binding_of_caller'
gem 'awesome_print'
gem 'rake'
gem 'pry', :require => false
gem 'chef'
end
group :test do
# Pretty printed test output
gem 'turn', :require => false
gem 'minitest'
gem 'forgery'
gem 'rspec'
gem 'minitest'
gem 'minitest-rails'
gem 'guard'
gem 'guard-bundler'
gem 'guard-minitest'
gem 'guard-livereload'
if RUBY_PLATFORM =~ /darwin/
gem 'rb-fsevent','~> 0.9.1'
elsif RUBY_PLATFORM =~ /linux/
gem 'rb-inotify'
end
gem 'factory_girl_rails'
end
# More info at https://github.com/guard/guard#readme
notification :tmux,
:display_message => true,
:timeout => 5, # in seconds
:default_message_format => '%s >> %s',
# the first %s will show the title, the second the message
# Alternately you can also configure *success_message_format*,
# *pending_message_format*, *failed_message_format*
:line_separator => ' > ', # since we are single line we need a separator
:color_location => 'status-left-bg' # to customize which tmux element will change color
group :frontend do
guard :bundler do
watch('Gemfile')
end
guard :livereload do
watch(%r{^app/.+\.(erb|haml)})
watch(%r{^app/helpers/.+\.rb})
watch(%r{^public/.+\.(css|js|html)})
watch(%r{^config/locales/.+\.yml})
end
end
group :backend do
end
guard 'minitest' do
# with Minitest::Unit
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r|^test/test_helper\.rb|) { "test" }
# Rails 3.2
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
watch(%r|^app/models/(.*)\.rb|) { |m| "test/unit/#{m[1]}_test.rb" }
end
require 'test_helper'
class SampleUnitTest < MiniTest::Spec
end
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/spec'
# Uncomment if you want awesome colorful output
require "minitest/pride"
class MiniTest::Spec
include FactoryGirl::Syntax::Methods
end
# include Devise::TestHelpers # use this if you have devise
class DateTime
include Comparable
end
# use awesome print
require 'awesome_print'
module MiniTest::Assertions
def mu_pp(obj)
obj.awesome_inspect
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment