Sha256: 42940283eb8133520c2d66134d06dde751dcae958b23b90da62b8ae75428d6a4

Contents?: true

Size: 840 Bytes

Versions: 9

Compression:

Stored size: 840 Bytes

Contents

require 'test_helper'

class PhoneTest < Test::Unit::TestCase
  include TestHelper
  
  def setup
    @client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET)
    @contact = @client.Contact.build

  end
  
  context "validators" do
    
    should "not allow long phone numbers" do
      @phone = @contact.add_phone(phone_number: "1234567890123456789012345678901234567890123456789012345678901234567890")
      assert_equal(false, @phone.valid?)
      blank_error = @phone.errors_for(:phone_number).first
      assert_not_nil(blank_error)
      assert_equal("must be shorter than 50 characters", blank_error)
      
    end

    should "allow phone numbers" do
      @phone = @contact.add_phone(phone_number: "12345690")

      assert_equal(true, @phone.valid?)
      assert_equal(0, @phone.errors.size)
    end
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
xeroizer-2.20.0 test/unit/models/phone_test.rb
xeroizer-2.19.0 test/unit/models/phone_test.rb
xeroizer-2.18.1 test/unit/models/phone_test.rb
xeroizer-2.17.1 test/unit/models/phone_test.rb
xeroizer-2.16.5 test/unit/models/phone_test.rb
xeroizer-2.16.4 test/unit/models/phone_test.rb
xeroizer-2.16.3 test/unit/models/phone_test.rb
xeroizer-2.16.1 test/unit/models/phone_test.rb
xeroizer-2.16.0 test/unit/models/phone_test.rb