Why won't Cucumber run in Padrino App under RubyMine?
I'm just starting a Padrino application, and moved a bare-bones "prove that Cucumber runs" Cucumber feature into it that ran successfully in an empty Ruby project.
In my Padrino app, I get the message:
Error running set_up_cucumber:
Cucumber './script/cucumber' script not found. To setup your Cucumber support please install Cucumber rails plugin or Cucumber Gem, reload generators and run 'New|Cucumber' generator from RubyMine.
So, I check my external libraries, and the cucumber gem exists there at version 1.0.2. Since this is not a Rails app, I do not have the Cucumber rails plugin installed.
In order to satisfy the above error, I have the following content:
require 'rake'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = ['--format', "Teamcity::Cucumber:Formatter", "--expand"]
end
duplicated in the following three files trying to identify one that works:
Rakefile
script/cucumber.rake
script/cucumber.rb
When I run 'cucumber' on the command line, Cucumber works fine.
I am running the following versions:
Package | Version |
---|---|
RubyMine | 3.2.3 |
Ruby | ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.7.0] |
rvm | 1.6.14 |
Any ideas on what I'm doing wrong w/ Rubymine? I'm confounded because I moved the Cucumber files from a Ruby gem project in which RubyMine worked fine. I'm wondering if there's something about my Padrino project's directory layout that is giving a hint to RubyMine that it's "really a Rails app"?
Thanks in advance,
Scott Smith - OldFartDeveloper
Please sign in to leave a comment.
Hi,
Is it a Rails application? Does Gemfile mentiones 'cucumber-rails' gem? Have you launched 'cucumber:instal' generator to setup cucumber framework for your rails application? Thanks, error message is a bit out dated, I filed an issue (http://youtrack.jetbrains.net/issue/RUBY-9171).
Better to use 'cucumber:install' generator, it generates "./script/cucumber" launch script (without 'rb' extension) and also correct supprt/env.rb, etc. (see cucucmber-rails gem documentation).
./sctipt/cucumber isn't a rake file or file with content in Rake build language. More over 'rake' and 'cucumber' script ways for launching cucumber tasks are independent.
Ah. So since this is a non-Rails application (uses Padrino instead), I simply did the following:
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
require File.expand_path(File.dirname(__FILE__) + "/../../config/boot")
require 'capybara/cucumber'
require 'rspec/expectations'
##
# You can handle all padrino applications using instead:
# Padrino.application
Capybara.app = Padrino.tap { |app| }
Now, when I run command-F8 for my feature file, it works fine.
I will probably have to re-visit the features/support/env.rb file again as the Padrino app builds up, but this is working fine for now.
Thanks for your reply; it had the concepts in it that I needed.
It would be helpful if the Cucumber folks would provide a non-Rails initializer. Hmm. Maybe I could do that. Hmm.
Message was edited by: Scott Smith. This clarifies what I did to get Cucumber working within RubyMine for this non-Rails application
Correct answer was to use ''cucumber:install" in rails applications and it will create necessary files. I'm not sure about content of your ./script/cucumber.rb. More over looks like it contains a rake task inside instead of necessary content.
Thanks, see my "how-to" above. I had to create a Rails 3 app just so I could run rake cucumber:install and copy the results over to my Padrino project.
Opps, sorry I didn't realize that "Padrino" as an alternative Ruby web development framework, like "Rails" . RM doens't provide any special support for Padrino framework and due to a bug http://youtrack.jetbrains.net/issue/RUBY-9257