Skip to content

Instantly share code, notes, and snippets.

@iamvery iamvery/.rspec
Last active Aug 29, 2015

Embed
What would you like to do?
app configuration files
--color
-r turnip/rspec

[APP NAME]

This is a short description of your app.

Getting Started

Requirements

  1. Ruby
  2. PostgreSQL (e.g. Postgres.app)

Setup

$ bin/bootstrap

Testing

$ bin/rspec

Running

$ bin/rails server
#!/bin/sh
set -e
brew_ensure() {
package=$1
brew info $package | grep "Not installed" > /dev/null 2>&1
if [[ "$?" -eq "0" ]]; then
brew install $package
fi
}
if ! which brew > /dev/null 2>&1; then
# Install http://brew.sh
echo '**** Installing Homebrew...'
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
echo '**** DONE!'
fi
echo '**** Install brew packages...'
# e.g. brew_ensure postgresql
echo '**** DONE!'
echo '**** Install gems...'
gem install bundler
bundle install
# Other gems not in Gemfile
# e.g. gem install foreman
echo '**** DONE!'
echo '**** Setting up database...'
bin/rake db:setup
RAILS_ENV=test bin/rake db:schema:load
echo '**** DONE!'
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
end
require 'dotenv'
Dotenv.load
RSpec.configure do |config|
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.disable_monkey_patching!
config.order = :random
Kernel.srand config.seed
end
require 'rails_spec_helper'
# e.g. require 'steps/some_steps'
# RSpec.configure do |c|
# e.g. c.include SomeSteps
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.