Francisco Trindade
2009-Feb-10 15:27 UTC
[rspec-users] Using cucumber profiles with rake task
Hi, Im trying to set up an environment where I am able to run different cucumber profiles (webrat/selenium) in the same project. I did manage to make them work using the cucumber command, so this command works: cucumber -p selenium features/done/items_selenium.feature The problem I have is when I try to do the same thing using the rake task. I followed the advice given on this thread (http://www.ruby-forum.com/topic/177404) and changed the rake task to what is described below, but apparently the rake task does not consider if you are passing a profile or not, and keeps requiring every file from the features directory, generating some conflicts. Cucumber::Rake::Task.new(:features) do |t| profile = ENV[''PROFILE''] || ''default'' t.cucumber_opts = "-p #{profile} --format progress" end I did manage to make it work using this parameters in the rake task: Cucumber::Rake::Task.new(:features) do |t| t.cucumber_opts = "--format progress" t.step_pattern ["features/webrat_steps/**/*.rb","features/support/webrat_env.rb"] t.feature_pattern = "features/**/*_webrat.feature" end but Im wondering if there is not a better way of doing this, reusing the elements from the cucumber profile. Am I missing something? Regards, Francisco -- Posted via http://www.ruby-forum.com/.
On Tue, Feb 10, 2009 at 10:27 AM, Francisco Trindade <lists at ruby-forum.com> wrote:> Hi, > > Im trying to set up an environment where I am able to run different > cucumber profiles (webrat/selenium) in the same project. > > I did manage to make them work using the cucumber command, so this > command works: > cucumber -p selenium features/done/items_selenium.feature > > The problem I have is when I try to do the same thing using the rake > task. I followed the advice given on this thread > (http://www.ruby-forum.com/topic/177404) and changed the rake task to > what is described below, but apparently the rake task does not consider > if you are passing a profile or not, and keeps requiring every file from > the features directory, generating some conflicts. > > Cucumber::Rake::Task.new(:features) do |t| > profile = ENV[''PROFILE''] || ''default'' > t.cucumber_opts = "-p #{profile} --format progress" > end > > > I did manage to make it work using this parameters in the rake task: > > Cucumber::Rake::Task.new(:features) do |t| > t.cucumber_opts = "--format progress" > t.step_pattern > ["features/webrat_steps/**/*.rb","features/support/webrat_env.rb"] > t.feature_pattern = "features/**/*_webrat.feature" > end > > but Im wondering if there is not a better way of doing this, reusing the > elements from the cucumber profile. > > Am I missing something? >The Cucumber rake task doesn''t support profiles very well. There is a ticket for this: http://rspec.lighthouseapp.com/projects/16211/tickets/187-rake-task-support-cucumberyml-profiles On the ticket Ben Mabey provided his current solution, which is to clear out the feature list: Cucumber::Rake::Task.new(:selenium) do |t| ENV[''WEBRAT''] = ''selenium'' t.cucumber_opts = "--profile selenium" t.feature_list = [] end -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com
Francisco Trindade
2009-Feb-10 16:54 UTC
[rspec-users] Using cucumber profiles with rake task
Thanks, now it makes sense. Regards, Francisco Zach Dennis wrote:> On Tue, Feb 10, 2009 at 10:27 AM, Francisco Trindade > <lists at ruby-forum.com> wrote: >> task. I followed the advice given on this thread >> >> elements from the cucumber profile. >> >> Am I missing something? >> > > The Cucumber rake task doesn''t support profiles very well. There is a > ticket for this: > > http://rspec.lighthouseapp.com/projects/16211/tickets/187-rake-task-support-cucumberyml-profiles > > On the ticket Ben Mabey provided his current solution, which is to > clear out the feature list: > > Cucumber::Rake::Task.new(:selenium) do |t| > ENV[''WEBRAT''] = ''selenium'' > t.cucumber_opts = "--profile selenium" > t.feature_list = [] > end > > > -- > Zach Dennis > http://www.continuousthinking.com > http://www.mutuallyhuman.com-- Posted via http://www.ruby-forum.com/.
----- Original Message ----> Message: 4 > Date: Tue, 10 Feb 2009 10:43:35 -0500 > From: Zach Dennis> The Cucumber rake task doesn''t support profiles very well. There is a > ticket for this: > > http://rspec.lighthouseapp.com/projects/16211/tickets/187-rake-task-support-cucumberyml-profiles > > On the ticket Ben Mabey provided his current solution, which is to > clear out the feature list: > > Cucumber::Rake::Task.new(:selenium) do |t| > ENV[''WEBRAT''] = ''selenium'' > t.cucumber_opts = "--profile selenium" > t.feature_list = [] > end >I just did this sort of thing, you also need to set t.step_list = [], else the rake task will expand all steps in the features directories as well. Forrest