Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimal number of files to run `rspec` from command-line in your folder
# Needed files:
# - Rakefile
# - Gemfile
# - spec/spec_helper
#####
## Gemfile
source 'https://rubygems.org'
gem 'rspec'
gem 'pry'
#####
## Rakefile
# encoding: utf-8
require 'rake'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end
#####
## spec/spec_helper.rb
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'pry'
require 'rspec/autorun'
require 'YOUR LIB NAME HERE'
RSpec.configure do |config|
config.filter_run_excluding skip: true
config.run_all_when_everything_filtered = true
config.filter_run :focus => true
config.order = "random"
# Use color in STDOUT
config.color_enabled = true
# Use the specified formatter
config.formatter = :documentation # :progress, :html, :textmate
# Use color not only in STDOUT but also in pagers and files
config.tty = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment