Sha256: 96eb3c982df7f47b0ddcc10976ea15bf0d77b46c7817c723b65b74f99aa79491

Contents?: true

Size: 1.12 KB

Versions: 16

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe IsinValidator do

  context "has a valid value" do
    let(:klass) do
      Class.new do
        include ActiveModel::Validations
        attr_accessor :isin, :name
        validates :isin, isin: true
      end
    end

    subject { klass.new }

    it { should allow_value("US0378331005").for(:isin) }
    it { should allow_value("AU0000XVGZA3").for(:isin) }

    it { should_not allow_value('').for(:isin) }
    it { should_not allow_value(' ').for(:isin) }
    it { should_not allow_value(nil).for(:isin) }
    it { should_not allow_value("US03783310055").for(:isin) }
    #it { should_not allow_value("US0378331004").for(:isin) }
    it { should_not allow_value("US037833100").for(:isin) }
    it { should_not allow_value("US03783315").for(:isin) }
    it { should_not allow_value("AA0000XVGZA3").for(:isin) }
    it { should_not allow_value("120378331004").for(:isin) }
    it { should_not allow_value("! \#$%\`|").for(:isin) }
    it { should_not allow_value("<>@[]\`|").for(:isin) }

    it { should ensure_valid_isin_format_of(:isin) }
    it { should_not ensure_valid_isin_format_of(:name) }
  end

end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
active_validation-1.0.0 spec/lib/isin_validator_spec.rb
yukonisuru-1.0.0 spec/lib/isin_validator_spec.rb
yukonisuru-0.0.1 spec/lib/isin_validator_spec.rb
flash_validators-3.0.12 spec/lib/isin_validator_spec.rb
flash_validators-3.0.11 spec/lib/isin_validator_spec.rb
flash_validators-3.0.10 spec/lib/isin_validator_spec.rb
flash_validators-3.0.9 spec/lib/isin_validator_spec.rb
flash_validators-3.0.8 spec/lib/isin_validator_spec.rb
flash_validators-3.0.7 spec/lib/isin_validator_spec.rb
flash_validators-3.0.6 spec/lib/isin_validator_spec.rb
flash_validators-3.0.5 spec/lib/isin_validator_spec.rb
flash_validators-3.0.4 spec/lib/isin_validator_spec.rb
flash_validators-3.0.3 spec/lib/isin_validator_spec.rb
flash_validators-3.0.2 spec/lib/isin_validator_spec.rb
flash_validators-3.0.1 spec/lib/isin_validator_spec.rb
flash_validators-3.0.0 spec/lib/isin_validator_spec.rb