Created
December 12, 2009 02:23
-
-
Save ydnar/254679 to your computer and use it in GitHub Desktop.
Yo dawg I heard you like Cucumber so we put scenarios in your steps so you can test while you test.
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
# Allow any Cucumber scenario to be called as a step in other scenarios | |
module Cucumber | |
module Ast | |
class Scenario | |
def initialize_with_awesome(*args) | |
initialize_without_awesome(*args) | |
src = @steps.map { |step| "When %Q{#{step.name}}" }.join("\n") | |
proc = Proc.new { eval src } | |
regexp = Regexp.new("^#{Regexp.escape(@name)}$") | |
Cucumber::RbSupport::RbDsl.register_rb_step_definition(regexp, proc) | |
end | |
alias_method_chain :initialize, :awesome | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment