class RSpec::Hanami::MatchType

Attributes

actual[R]
expected[R]

Public Class Methods

new(actual, expected) click to toggle source
# File lib/rspec/hanami/match_type.rb, line 6
def initialize(actual, expected)
  @actual = actual
  @expected = expected
end

Public Instance Methods

call() click to toggle source
# File lib/rspec/hanami/match_type.rb, line 11
def call
  match_types?
end

Private Instance Methods

match_if_sum?() click to toggle source
# File lib/rspec/hanami/match_type.rb, line 23
def match_if_sum?
  expected.primitive?(actual)
end
match_types?() click to toggle source
# File lib/rspec/hanami/match_type.rb, line 17
def match_types?
  return match_if_sum? if expected.class == Dry::Types::Sum

  actual.is_a?(expected.primitive)
end