netzpirat / guard-cucumber

Guard::Cucumber automatically runs your features (much like autotest)
https://rubygems.org/gems/guard-cucumber
MIT License
40 stars 56 forks source link

No errors displayed #29

Closed rhodee closed 12 years ago

rhodee commented 12 years ago

I am learning BDD using cucumber. So any pointers regarding my dotfiles, approach are appreciated. My issues seems almost identical to this one. However I am unable to use this solution to solve my problem.

This is the output from my terminal:

Guard uses Libnotify to send notifications.
Guard is now watching at '/home/rhodee/GitRepos/projects/adelante'
Starting Spork for RSpec, Cucumber
Using Cucumber
Using RSpec
Preloading Rails environment
.../support/env.rb has not been bootstrapped.  Run spork --bootstrap to do so.
Loading Spork.prefork block...
Preloading Rails environment
Spork is ready and listening on 8990!
Spork is ready and listening on 8989!
Spork server for RSpec, Cucumber successfully started
Running all features
Disabling profiles...
UUU

1 scenario (1 undefined)
3 steps (3 undefined)
0m1.332s

I believe where the UUU string appears I should see my errors. I am able to see the errors when running bundle exec rake cucumber outside of Guard.

Gemfile: group :development do gem 'ffaker' gem 'annotate', git: 'https://github.com/ctran/annotate_models.git' gem 'libnotify' gem 'guard-livereload' gem 'guard-spork' gem 'guard-cucumber' gem 'spork', "~> 0.9.0.rc" end

group :test do gem 'rspec-rails', "~> 2.7.0" gem 'database_cleaner', "~> 0.7.0" gem 'cucumber-rails', "~> 1.2.1" gem 'factory_girl_rails', "~> 1.4.0" gem 'spork', "~> 0.9.0.rc" end

The Guardfile contains:

guard 'spork' do watch('config/application.rb') watch('config/environment.rb') watch(%r{^config/environments/..rb$}) watch(%r{^config/initializers/..rb$}) watch(%r{^spec/support/.+.rb$}) watch('Gemfile') watch('Gemfile.lock') watch('spec/spec_helper.rb') { :rspec } watch(%r{features/support/}) { :cucumber } watch('spec/spec_helper.rb') end

guard 'cucumber' do watch(%r{^features/.+.feature$}) watch(%r{^features/support/.+$}) { 'features' } watch(%r{^features/step_definitions/(.+)_steps.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } end

guard 'livereload' do watch(%r{app/.+.(erb|haml)}) watch(%r{app/helpers/.+.rb}) watch(%r{(public/|app/assets).+.(css|js|html)}) watch(%r{(app/assets/.+.css).s[ac]ss}) { |m| m[1] } watch(%r{(app/assets/.+.js).coffee}) { |m| m[1] } watch(%r{config/locales/.+.yml}) end

The error is on the playground branch of my repo adelante.

Cheers.

netzpirat commented 12 years ago

UUU means you have not defined the step definitions. You'd see that if you didn't try to bring a full blown BDD setup into play that is not configured at all:

Do yourself a favor and don't use Spork at the beginning. Start with a plain Cucumber/Guard setup and move on to Spork when you fully understand your setup. Spork brings a level of complexity into the mix that must be fully understood, otherwise you'll have plenty of problems.

So removing guard-spork from your Guardfile and just running guard-cucumber shows me:

Guard is now watching at '/Users/michi/Repositories/adelante'
Running all features
Disabling profiles...
UUU

1 scenario (1 undefined)
3 steps (3 undefined)
0m0.564s

You can implement step definitions for undefined steps with these snippets:

Given /^there is a valid user$/ do
  pending # express the regexp above with the code you wish you had
end

When /^a post is created$/ do
  pending # express the regexp above with the code you wish you had
end

Then /^it should be visible on the index page$/ do
  pending # express the regexp above with the code you wish you had
end

So now you have to define your step definitions. Please see the Cucumber Wiki for detailed instructions or better buy the The Cucumber Book to easily get started.