Sha256: 822f082679ab4ef19c33929944fe0b94149b0b72e1bbf18f8767c96905a2bb59

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

require 'rails_helper'

describe Dorsale::TextHelper, type: :helper do
  it "hours" do
    expect(hours(nil)).to be nil
    expect(hours(1)).to eq "1.00 hour"
    expect(hours(3)).to eq "3.00 hours"
    expect(hours(3.5)).to eq "3.50 hours"
    expect(hours(3.123)).to eq "3.12 hours"
  end

  it "number" do
    expect(number(nil)).to be nil
    expect(number(1)).to eq "1"
    expect(number(1.2)).to eq "1.20"
    expect(number(1.234)).to eq "1.23"
    expect(number(123456.789)).to eq "123,456.79"
  end

  it "percentage" do
    expect(percentage(nil)).to be nil
    expect(percentage(1)).to eq "1 %"
    expect(percentage(1.123)).to eq "1.12 %"
  end

  it "euros" do
    expect(euros(nil)).to be nil
    expect(euros(1)).to eq "1 €"
    expect(euros(1.123)).to eq "1.12 €"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dorsale-1.2.6 spec/helpers/dorsale/text_helper_spec.rb