class DuckTesting::Violation

Attributes

call_data[R]
expected_types[R]
param[R]
param_or_return[R]

Public Class Methods

new(call_data: nil, param: nil, expected_types: nil, param_or_return: nil) click to toggle source

@param call_data [DuckTesting::MethodCallData] @param param [Object] the given object. @param expected_types [Array<DuckTesting::Type::Base>] the expected object types. @param param_or_return [Symbol] the report type, ‘:param` or `:return`

# File lib/duck_testing/violation.rb, line 15
def initialize(call_data: nil, param: nil, expected_types: nil, param_or_return: nil)
  @call_data = call_data
  @param = param
  @expected_types = expected_types
  @param_or_return = param_or_return
end

Public Instance Methods

expected() click to toggle source

@return [String]

# File lib/duck_testing/violation.rb, line 33
def expected
  expected_types.map(&:to_s).join(", ")
end
param?() click to toggle source

@return [Boolean]

# File lib/duck_testing/violation.rb, line 23
def param?
  param_or_return == :param
end
return?() click to toggle source

@return [Boolean]

# File lib/duck_testing/violation.rb, line 28
def return?
  param_or_return == :return
end