Sha256: dff3f282c95c84ce1f944e66a7ef3c220d0de4cdf70a25a2d674ce7ba097496e
Contents?: true
Size: 732 Bytes
Versions: 1
Compression:
Stored size: 732 Bytes
Contents
require 'spec_helper' require 'shoulda-matchers' describe Shoulda::Matchers::ActiveModel::ValidateAsTelephoneMatcher do context "on a attribute which validates telephone" do it "should require a valid telephone" do @user = User.new(:telephone => '123456') @user.should validate_as_telephone(:telephone) end it "should allow a nil value" do @user = User.new(:telephone => nil) @user.should validate_as_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_telephone(:telephone) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_telephone-0.1.0 | spec/shoulda-matchers/validate_as_telephone_matcher_spec.rb |