Sha256: 479685f7e4e2d77c712e6f6f4295e503d87e072238c6a3cb78089b096c372e72

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'
require 'remarkable/active_record'

describe Remarkable::ActiveRecord::Matchers::ValidateAsBrTelephoneMatcher do
  context "on a attribute which validates telephone" do
    it "should require a valid telephone" do
      @user = BrUser.new(:telephone => '123456')
      @user.should validate_as_br_telephone(:telephone)
    end

    it "should allow a nil value" do
      @user = BrUser.new(:telephone => nil)
      @user.should validate_as_br_telephone(:telephone)
    end
  end

  context "on a attribute which not validates telephone" do
    before do
      @user = Admin.new(:telephone => '123456')
    end

    it "should not require a valid telephone" do
      @user.should_not validate_as_br_telephone(:telephone)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validates_telephone-0.2.1 spec/remarkable/validate_as_br_telephone_matcher_spec.rb
validates_telephone-0.2.0 spec/remarkable/validate_as_br_telephone_matcher_spec.rb