Created
December 12, 2011 18:20
-
-
Save natritmeyer/1468432 to your computer and use it in GitHub Desktop.
A cucumber formatter to allow doing stuff when a tag is first come across
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
#cucumber -f TestManagement::TagLogic -o /dev/null | |
module TestManagement | |
class TagLogic | |
#leave this alone... | |
def initialize(step_mother, io, options) | |
@old_tags = [] | |
end | |
#leave this alone too... | |
def tag_name(tag) | |
is_new_tag = !@old_tags.include?(tag) | |
@old_tags << tag if is_new_tag | |
perform_logic_for(tag) if is_new_tag | |
end | |
#add your logic here! | |
def perform_logic_for tag_name | |
puts "I've just come across #{tag_name}, going to do something with it..." | |
# put your logic here | |
# eg: | |
case tag_name | |
when "@users" | |
#load up a bunch of users | |
when "@expired_account" | |
#load an expired account | |
when "@etc" | |
#do something | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment