gem install rails
rails new my_app -T
Add this to your Gemfile
gem 'haml-rails'
gem 'simple_form'
group :test, :development do
gem "rspec-rails"
gem 'rspec-instafail'
gem 'rb-fsevent'
gem 'growl'
gem 'pry'
gem 'factory_girl_rails'
gem 'database_cleaner'
gem "factory_girl_rails"
gem "capybara"
gem 'guard-spork'
gem "guard-bundler"
gem "guard-rspec"
gem "guard-migrate"
end
# in config/application.rb
config.generators do |g|
g.test_framework :rspec, :fixture => true
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
g.template_engine :haml
end
In Rails 3+, the lib directory is no longer autoloaded.
# in config/application.rb
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
rails g rspec:install
spork --bootstrap
Then edit spec/spec_helper.rb
and move everything into the prefork
section.
Edit spec/spec_helper.rb
.
Put this in the prefork
section:
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
Put this in the each_run
section:
DatabaseCleaner.clean
Comment out the config.fixture_path
line in spec/spec_helper.rb
...the comment above implies it shouldn't be used if we're not using ActiveRecord fixtures.
echo '--colour
--drb
--require rspec/instafail
--format RSpec::Instafail' > .rspec
The --drb
is needed for spork and --colour
is for color, because it's pretty.
In your config/environments/development.rb
, near the end before the
YourAppName::Application.configure
block, put this:
silence_warnings do
begin
require 'pry'
IRB = Pry
rescue LoadError
end
end
Now rails c
will startup using pry. You can also add bindings.pry
anyplace and your app will stop there with a pry prompt until you exit
it.
See Also:
Run these commands:
guard init
guard init bundler
guard init spork
guard init migrate
guard init rspec
You may have to monkey withy our Guardfile
some but the order should be right.
If you use rvm, you don't need the bundle exec part. But you are correct if you are not using bundle exec.