class Fitting::Report::Actions

Public Class Methods

new(actions) click to toggle source
# File lib/fitting/report/actions.rb, line 6
def initialize(actions)
  @actions = []
  actions.to_a.map do |action|
    @actions.push(Fitting::Report::Action.new(action))
  end
end

Public Instance Methods

cram_into_the_appropriate_action(test) click to toggle source
# File lib/fitting/report/actions.rb, line 34
def cram_into_the_appropriate_action(test)
  @actions.map do |action|
    if test.method == action.method && action.path_match(test.path)
      action.add_test(test)
      return
    end
  end
end
details(prefix) click to toggle source
# File lib/fitting/report/actions.rb, line 43
def details(prefix)
  {
      tests_without_actions: prefix.tests.without_actions,
      actions_details: @actions.map { |a| {method: a.method, path: a.path, tests_size: a.tests.size, responses: a.details} }
  }
end
is_there_a_suitable_action?(test) click to toggle source
# File lib/fitting/report/actions.rb, line 26
def is_there_a_suitable_action?(test)
  @actions.map do |action|
    return true if test.method == action.method && action.path_match(test.path)
  end

  false
end
join(tests) click to toggle source
# File lib/fitting/report/actions.rb, line 17
def join(tests)
  tests.to_a.map do |test|
    if is_there_a_suitable_action?(test)
      cram_into_the_appropriate_action(test)
      test.mark_action
    end
  end
end
to_a() click to toggle source
# File lib/fitting/report/actions.rb, line 13
def to_a
  @actions
end