Created
November 8, 2010 10:14
-
-
Save s2k/667546 to your computer and use it in GitHub Desktop.
Find and list the Cucumber step definitions in a project
This file contains 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
path = File.join( File.dirname( __FILE__), 'features', 'step_definitions', '**', '*.rb' ) | |
Dir[ path ].each{ | sdf | | |
puts "In #{ sdf }:" | |
lines = File.read( sdf ) | |
puts lines | |
puts "STEPS" | |
lines.scan( /^\s*(Given|When|Then|And|But)\s+(.+)\s+(do|\{)(\s+\|.+\|)?$/ ).map{ | m | | |
# pp match | |
puts "#{ m[0] }: #{ m[ 1 ] }" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment