Sha256: 6c36f83cda1c1bc8283d042dcc11d4a71ffac056519b56cd7a4562a6cc5741c2

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe Faker::Russian do
  describe '#correspondent_account' do
    let(:bik) { Faker::Russian.bik }

    before(:all) do
      DummyModel.reset_callbacks(:validate)
      DummyModel.validates(:field, ks_format: true)
    end

    it 'generate valid correspondent account without arguments' do
      100.times do
        expect(DummyModel.new(field: Faker::Russian.correspondent_account)).to be_valid
      end
    end

    it 'generate valid correspondent account with bik' do
      100.times do
        expect(DummyModel.new(field: Faker::Russian.correspondent_account(bik: bik))).to be_valid
      end
    end

    it 'generate correspondent account for given bik' do
      100.times do
        expect(Faker::Russian.correspondent_account(bik: bik)[-3..-1]).to eq bik[-3..-1]
      end
    end

    it 'generate difference correspondent account with sequence' do
      sequenced_cas = 1000.times.map{ |n| Faker::Russian.correspondent_account(sequence_number: n) }
      expect(sequenced_cas.size).to eq(sequenced_cas.uniq.size)
    end

    it 'generate same correspondent accounts for sequence' do
      array1 = 1000.times.map{ |n| Faker::Russian.correspondent_account(sequence_number: n) }
      array2 = 1000.times.map{ |n| Faker::Russian.correspondent_account(sequence_number: n) }
      expect(array1).to eq(array2)
    end

    it 'permit just a few options' do
      expect{ Faker::Russian.correspondent_account(shit: 'shit') }.to raise_error(ArgumentError)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
faker-russian-0.0.6 spec/faker/russian/correspondent_account_spec.rb
faker-russian-0.0.5 spec/faker/russian/correspondent_account_spec.rb