Forum: RSpec [Cucumber] - default rake task

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee6788c2faaad7a5cd0bc466c9ea60d8?d=identicon&s=25 aidy lewis (Guest)
on 2009-01-13 19:08
(Received via mailing list)
Hi,

I have a Rake problem.

I would like the default task to run after :features.

Curently it doesn't when :features fails. Could you please help?


<RAKE>
require 'cucumber/rake/task'

def send_dcs_email_report(path_to_story_results)
  ###
end

Cucumber::Rake::Task.new("features", "All features in IE") do |t|
  t.cucumber_opts = "--format html --out story-results.html"
end

task :default => :features do
  path_to_story_results =
File.expand_path(File.dirname(".")).gsub("/", "\\") +
"\\story-results.html"
  send_dcs_email_report(path_to_story_results)
end
</RAKE>

Thanks

Aidy
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 Matt Wynne (mattwynne)
on 2009-01-13 19:26
(Received via mailing list)
On 13 Jan 2009, at 18:02, aidy lewis wrote:

> require 'cucumber/rake/task'
>  path_to_story_results =
> File.expand_path(File.dirname(".")).gsub("/", "\\") +
> "\\story-results.html"
>  send_dcs_email_report(path_to_story_results)
> end
> </RAKE>
>
> Thanks
>
> Aidy

You could do something like this:

task :default do
   begin
     Rake::Task[:features].invoke
   ensure
     path_to_story_results =
File.expand_path(File.dirname(".")).gsub("/", "\\") + "\\story-
results.html"
     send_dcs_email_report(path_to_story_results)
   end
end

does that work?

>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com
Ee6788c2faaad7a5cd0bc466c9ea60d8?d=identicon&s=25 aidy lewis (Guest)
on 2009-01-13 19:45
(Received via mailing list)
On 13/01/2009, Matt Wynne <matt@mattwynne.net> wrote:
> > Curently it doesn't when :features fails. Could you please help?
> IE") do |t|
> >
>   ensure
>     path_to_story_results =
> File.expand_path(File.dirname(".")).gsub("/", "\\") +
> "\\story-results.html"
>     send_dcs_email_report(path_to_story_results)
>   end
>  end
>
>  does that work?
>

Like a dream Matt.

Thanks

Aidy
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-01-13 20:23
(Received via mailing list)
On Tue, Jan 13, 2009 at 7:02 PM, aidy lewis
<aidy.lewis@googlemail.com>wrote:

> require 'cucumber/rake/task'
>  path_to_story_results =
> File.expand_path(File.dirname(".")).gsub("/", "\\") +
> "\\story-results.html"
>  send_dcs_email_report(path_to_story_results)
> end
> </RAKE>
>

Rake immediately stops when a task fails.

I'm assuming you're using some sort of CI since you're sending emails.
I'd
make the CI send email instead of Rake.

Aslak
This topic is locked and can not be replied to.