module Gurke::DSL
Public Instance Methods
Given(pattern, method_name = nil, opts = {}, &block)
click to toggle source
rubocop:disable MethodName
# File lib/gurke/dsl.rb, line 35 def Given(pattern, method_name = nil, opts = {}, &block) step pattern, method_name, opts.merge(type: :given), &block end
Then(pattern, method_name = nil, opts = {}, &block)
click to toggle source
# File lib/gurke/dsl.rb, line 43 def Then(pattern, method_name = nil, opts = {}, &block) step pattern, method_name, opts.merge(type: :then), &block end
When(pattern, method_name = nil, opts = {}, &block)
click to toggle source
# File lib/gurke/dsl.rb, line 39 def When(pattern, method_name = nil, opts = {}, &block) step pattern, method_name, opts.merge(type: :when), &block end
_define_step(pattern, method_name, opts, &block)
click to toggle source
# File lib/gurke/dsl.rb, line 20 def _define_step(pattern, method_name, opts, &block) step = StepDefinition.new(pattern, opts) define_method("match: #{step.method_name}") do |name, s = nil| step.match(name, s) end if block_given? define_method(step.method_name.to_s, &block) elsif method_name alias_method step.method_name.to_s, method_name end end
step(pattern, method_name = nil, opts = {}, &block)
click to toggle source
# File lib/gurke/dsl.rb, line 5 def step(pattern, method_name = nil, opts = {}, &block) if method_name.is_a?(Hash) && opts.empty? opts = method_name method_name = nil end if method_name && block_given? raise ArgumentError.new <<~ERR.strip You can either specify a method name or given a block, not both. ERR end _define_step(pattern, method_name, opts, &block) end