Sha256: 2785d481c7bf91551874b8eb2741c46ed83545cfedc17cdabc99435cd1650fff

Contents?: true

Size: 1.11 KB

Versions: 109

Compression:

Stored size: 1.11 KB

Contents

require 'rails_helper'

describe PgEngine::PrintHelper do
  describe '#print_cuit' do
    subject { print_cuit(input) }

    context 'cuando es nil' do
      let(:input) { nil }

      it { expect(subject).to be_nil }
    end

    context 'cuando es un cuit válido' do
      let(:input) { 20_351_404_478 }

      it { expect(subject).to eq '20-35140447-8' }
    end

    context 'cuando es un cuit válido mal formateado' do
      let(:input) { '2035140447-8' }

      it { expect(subject).to eq '20-35140447-8' }
    end

    context 'cuando no es un cuit válido' do
      let(:input) { 2035 }

      it { expect(subject).to eq 2035 }
    end
  end

  describe '#print_currency' do
    subject { print_currency(input) }

    context 'cuando es un entero' do
      let(:input) { 191_624 }

      it { expect(subject).to eq '$ 191.624' }
    end

    context 'cuando tiene 1 decimal' do
      let(:input) { 123_456.1 }

      it { expect(subject).to eq '$ 123.456,10' }
    end

    context 'cuando tiene más de 3 decimales' do
      let(:input) { 123_456.164234 }

      it { expect(subject).to eq '$ 123.456,164' }
    end
  end
end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
pg_rails-7.6.23 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.22 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.22.pre.3 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.22.pre.2 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.22.pre.1 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.11 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.10 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.9 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.8 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.7 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.6 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.5 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.4 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.3 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.2 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.21.pre.1 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.20 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.19 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb
pg_rails-7.6.18 pg_engine/spec/helpers/pg_engine/print_helper_spec.rb