Skip to content

Instantly share code, notes, and snippets.

@ydnar
Created December 12, 2009 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ydnar/254679 to your computer and use it in GitHub Desktop.
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.
# 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