Sha256: aea79efc3b263e6405aabd1f93ec9bda3f538cb29561426c5381e96ff37ed4c4

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
require 'remarkable/active_model'

describe Remarkable::ActiveModel::Matchers::RequireAValidTelephoneMatcher do
  before :each do
    @user = User.new
  end

  it "should accept on telephone" do
    @user.should require_a_valid_telephone(:telephone)
  end

  it "should accept without a specified attribute" do
    @user.should require_a_valid_telephone
  end

  it "should reject on br_telephone" do
    @user.should_not require_a_valid_telephone(:br_telephone)
  end

  context "with :br as locale" do
    it "should accept on br_telephone" do
      @user.should require_a_valid_telephone(:br_telephone).from(:br)
    end

    it "should reject on usa_telephone" do
      @user.should_not require_a_valid_telephone(:usa_telephone).from(:br)
    end
  end

  context "with :usa as locale" do
    it "should accept on usa_telephone" do
      @user.should require_a_valid_telephone(:usa_telephone).from(:usa)
    end

    it "should reject on br_telephone" do
      @user.should_not require_a_valid_telephone(:br_telephone).from(:usa)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_telephone-1.1.0 spec/validates_telephone/remarkable/require_a_valid_telephone_matcher_spec.rb
validates_telephone-1.0.1 spec/validates_telephone/remarkable/require_a_valid_telephone_matcher_spec.rb
validates_telephone-1.0.0 spec/validates_telephone/remarkable/require_a_valid_telephone_matcher_spec.rb