Sha256: 7e00e319a32523fe0c48d9f90af8518aea1fad01aac1204c03fc341066efc25e

Contents?: true

Size: 661 Bytes

Versions: 6

Compression:

Stored size: 661 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
fortnox-api-0.5.2 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.5.1 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.5.0 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.4.0 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.3.0 spec/support/matchers/type/have_email_matcher.rb
fortnox-api-0.2.0 spec/support/matchers/type/have_email_matcher.rb