Sha256: 551d7f20ae277eab4618f1bf8e5104791440e3dea8cbc4367ae7e134e2d22a02

Contents?: true

Size: 674 Bytes

Versions: 8

Compression:

Stored size: 674 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[@attribute]
        @actual_type == Fortnox::API::Types::Email
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fortnox-api-0.8.0 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.7.2 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.7.1 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.7.0 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.6.3 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.6.2 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.6.1 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.6.0 spec/support/matchers/type/have_email_matcher.rb