Welcome to mirror list, hosted at ThFree Co, Russian Federation.

value_spec.rb « summary « cycle_analytics « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 41b0604bee0a6009cc593c0f255f3e45851dae4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Gitlab::CycleAnalytics::Summary::Value do
  describe Gitlab::CycleAnalytics::Summary::Value::None do
    it 'returns `-`' do
      expect(described_class.new.to_s).to eq('-')
    end
  end

  describe Gitlab::CycleAnalytics::Summary::Value::Numeric do
    it 'returns the string representation of the number' do
      expect(described_class.new(3.2).to_s).to eq('3.2')
    end
  end

  describe Gitlab::CycleAnalytics::Summary::Value::PrettyNumeric do
    describe '#to_s' do
      it 'returns `-` when the number is 0' do
        expect(described_class.new(0).to_s).to eq('-')
      end

      it 'returns `-` when the number is nil' do
        expect(described_class.new(nil).to_s).to eq('-')
      end

      it 'returns the string representation of the number' do
        expect(described_class.new(100).to_s).to eq('100')
      end
    end
  end
end