2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'fast_spec_helper'
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::CycleAnalytics::Summary::Value do
|
2020-05-24 23:13:21 +05:30
|
|
|
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
|