Sha256: aa0b533aa94d145debe645f65aabe262bb0c74bee7d0b59aaa188bb284901317

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

if respond_to?(:After)
  $failed_cucumber_specs = 0

  After do |scenario|
    if(scenario.failed?)
      $failed_cucumber_specs += 1
      `notify-send "Cucumber: #{scenario.exception.class}", "#{scenario.exception.message.gsub(/"/, "'")}"`
    end
  end
end

at_exit do
  # test global variable: it's set only if cucumber is loaded (Object responds_to? :After message)
  if $failed_cucumber_specs
    if $failed_cucumber_specs == 0
      `notify-send "Cucumber: no failed specs", "No failed specs"`
    else
      `notify-send "Cucumber: #{$failed_cucumber_specs} failed specs", "#{$failed_cucumber_specs} failed specs"`
    end
  end
end


require 'cucumber/formatter/pretty'

class NotifyOSDCucumberFormatter < Cucumber::Formatter::Pretty
  def exception(exception, status)
    super(exception, status)
    `notify-send "Cucumber: #{exception.class}", "#{exception.message.gsub(/("|`)/, "'")}"`
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rnotify-0.2 lib/adapters/cucumber.rb