Sha256: fe521b3866e7117943580677bf93341d50c19ad516799fc80bcc35bb3faf96b6
Contents?: true
Size: 707 Bytes
Versions: 3
Compression:
Stored size: 707 Bytes
Contents
# frozen_string_literal: true module Matchers module Type def have_email(attribute, valid_hash = {}) HaveEmailMatcher.new(attribute, valid_hash) end class HaveEmailMatcher < TypeMatcher def initialize(attribute, valid_hash) super(attribute, valid_hash, 'email', 'valid@email.com', 'invalid@email_without_top_domain') @expected_error = "Exception missing for invalid value #{@invalid_value.inspect}" @expected_type = Fortnox::API::Types::Email end private def expected_type? @actual_type = @klass.schema.keys.find { |x| x.name == @attribute }&.type @actual_type == Fortnox::API::Types::Email end end end end
Version data entries
3 entries across 3 versions & 1 rubygems