Skip to content

Instantly share code, notes, and snippets.

@marsz
Created October 20, 2016 16:02
Show Gist options
  • Save marsz/0426ebbd032b1c664686a901e60b7d8c to your computer and use it in GitHub Desktop.
Save marsz/0426ebbd032b1c664686a901e60b7d8c to your computer and use it in GitHub Desktop.
Monkey patching of RSpec example gruop for document output with gherkin language format
# put this file to spec/support/
module RSpec
module Core
class ExampleGroup
def self.Then(*args, &block)
args[0] = "Then #{args[0]}" if args[0].is_a?(String)
it(*args, &block)
end
def self.Given(*args, &block)
args[0] = "Given #{args[0]}" if args[0].is_a?(String)
describe(*args, &block)
end
def self.When(*args, &block)
args[0] = "When #{args[0]}" if args[0].is_a?(String)
describe(*args, &block)
end
def self.Scenario(*args, &block)
args[0] = "Scenario: #{args[0]}" if args[0].is_a?(String)
describe(*args, &block)
end
def self.feature(*args, &block)
args[0] = "Feature: #{args[0]}" if args[0].is_a?(String)
describe(*args, &block)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment