Sha256: d577aaa922b8ae4a77588cadd5a106d206f36442a3837b532feb0798fbe05832

Contents?: true

Size: 637 Bytes

Versions: 5

Compression:

Stored size: 637 Bytes

Contents

require 'spec_helper'

module BicValidation
  describe BicValidator do
    class Model
      include ActiveModel::Validations
      attr_accessor :bic
      validates :bic, bic: true

      def initialize(bic)
        @bic = bic
      end
    end

    it 'is valid' do
      model = Model.new 'DEUTDEFF'
      model.valid?
      expect(model.errors.count).to eq(0)
    end

    it 'is unknown' do
      model = Model.new 'DXUTDEFF'
      model.valid?
      expect(model.errors.count).to eq(1)
    end

    it 'is invalid' do
      model = Model.new 'DXUTDE'
      model.valid?
      expect(model.errors.count).to eq(1)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bic_validation-0.3.1 spec/bic_validation/bic_validator_spec.rb
bic_validation-0.3.0 spec/bic_validation/bic_validator_spec.rb
bic_validation-0.2.1 spec/bic_validation/bic_validator_spec.rb
bic_validation-0.2.0 spec/bic_validation/bic_validator_spec.rb
bic_validation-0.1.0 spec/bic_validation/bic_validator_spec.rb