Module: Doa::InstanceMethods

Defined in:
lib/doa/instance_methods.rb

Overview

Methods available inside individual cases.

Instance Method Summary collapse

Instance Method Details

#do_action(*args) ⇒ Object

Alias for #doa



53
54
55
# File 'lib/doa/instance_methods.rb', line 53

def do_action(*args)
  doa(*args)
end

#doa(per_call_params = Hash.new) ⇒ Object

Perform the action using the parameters that result from merging the context’s parameters with those that were passed as an argument.



47
48
49
50
# File 'lib/doa/instance_methods.rb', line 47

def doa(per_call_params = Hash.new)
  send(action_method, action_name,
       self.params.deep_merge(per_call_params))
end

#paramsObject

Returns the parameters to be used in a given test case. The parameters are the result of merging the parameters from the top most context down to the current one.



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/doa/instance_methods.rb', line 30

def params
  return @_params if @_params

  p = Doa.default_params.try(:clone) ||
    HashWithIndifferentAccess.new

  p.deep_merge!(super_params)
  p.deep_merge!(action_params)
  p.deep_merge!(self.instance_eval(&default_params)) if default_params
  p.deep_merge!(shared_params)

  @_params = HashWithIndifferentAccess.new(p)
end