Created
September 24, 2013 17:59
-
-
Save DylanLacey/6688784 to your computer and use it in GitHub Desktop.
Hijacking the "Pretty" formatter to tag individual actions for Sauce with the step being executed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "cucumber/formatter/pretty" | |
module Sauce | |
class SauceFormatter < Cucumber::Formatter::Pretty | |
def initialize(step_mother, io, options) | |
super | |
end | |
def before_step(step) | |
message = "Cucumber step -- #{step.name}" | |
::Capybara.current_session.execute_script("sauce:context=#{message}") | |
super | |
end | |
end | |
end |
Here are comments how to use this code:
You can find the sample at https://gist.github.com/DylanLacey/6688784 and run it with 'cucumber --format Sauce::SauceFormatter. You need to require it before your features run, so the best place to place it is in features/support/sauce_formatter.rb (or similar).
I've tried this code - it works like a charm.
Thank you
Oh, sweet, thanks for putting the usage instructions!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neat.
Thank you for help.