Sha256: 5b0531ce6975e090daa868fc7e31b4812ec18e223bc1ba1e1f11be3b37e14fbc

Contents?: true

Size: 764 Bytes

Versions: 6

Compression:

Stored size: 764 Bytes

Contents

# The first scenario that fails, we want to save and launch the page in the Browser.
# We don't want to to open subsequent failures, as that can be HIGHLY annoying when running from the command line.
#
# Also, this https://gist.github.com/398643
# has good info on how to save Assets/CSS so we can see the full version of the page.
#
module LaunchOnFirstFailure
  class << self
    attr_accessor :failed_tests
    def failure_occurred
      self.failed_tests = 0 unless failed_tests
      self.failed_tests += 1
    end
    def failed_tests?
      failed_tests && failed_tests >= 0
    end
  end
end

After('~@cli')do |scenario|
  if scenario.failed? && !LaunchOnFirstFailure.failed_tests?
    LaunchOnFirstFailure.failure_occurred
    save_and_open_page
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
browsercms-3.4.2 features/support/open_on_first_failure.rb
browsercms-3.4.2.rc1 features/support/open_on_first_failure.rb
browsercms-3.4.1 features/support/open_on_first_failure.rb
browsercms-3.4.0 features/support/open_on_first_failure.rb
browsercms-3.4.0.rc2 features/support/open_on_first_failure.rb
browsercms-3.4.0.rc1 features/support/open_on_first_failure.rb