Skip to content

Instantly share code, notes, and snippets.

@JanDintel
Last active December 20, 2015 04:29
Show Gist options
  • Save JanDintel/6071168 to your computer and use it in GitHub Desktop.
Save JanDintel/6071168 to your computer and use it in GitHub Desktop.
Install Cucumber with Rspec, Guard (and livereload) and Spork

Install Cucumber with Rspec, Guard and Spork

Using during Hartl rails 4.0 guide (http://ruby.railstutorial.org/chapters)

Gems

group :development, :test
  gem 'guard-rspec'
  gem 'guard-livereload'
  gem 'spork-rails', github: 'sporkrb/spork-rails' # RubyGems.org nog uptodate
  gem 'guard-spork'
  gem 'childprocess'
end

group :test do
  gem 'selenium-webdriver', '2.0.0'
  gem 'capybara', '2.1.0'
  gem 'factory_girl_rails'
  gem 'cucumber', '1.2.5' # Spork not supported as of Cucumber 1.3.0, need to use 1.2.5
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
end

Install instruction

$ bundle install

$ rails generate rspec:install
$ bundle guard init rspec

Edit guard file, change to: (/Guardfile)

guard 'rspec', after_all_pass: false, cli: '--drb' do

$ bundle spork --bootstrap

Edit spec file, to set up spork: (/spec/spec_helper.rb)

    Spork.prefork do
      ENV["RAILS_ENV"] ||= 'test'
      require File.expand_path("../../config/environment", __FILE__)
      require 'rspec/rails'
      require 'rspec/autorun'
      .
      .
      .
      RSpec.configure do |config|
      .
      .
      .
      end
    end

$ bundle guard init spork

Now you can start guard with spork (but don't do it, Cucumber is still to go)

$ bundle guard

Install Cucumber

$ rails generate cucumber:install --spork

Done!

Run test with cucumber

$ bundle cucumber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment