File: version_spec.rb

package info (click to toggle)
ruby-retryable 3.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: ruby: 512; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 929 bytes parent folder | download
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
require 'spec_helper'

RSpec.describe Retryable::Version do
  before do
    allow(described_class).to receive(:major).and_return(2)
    allow(described_class).to receive(:minor).and_return(0)
    allow(described_class).to receive(:patch).and_return(4)
  end

  describe '.to_h' do
    it 'returns a hash with the right values' do
      expect(described_class.to_h).to be_a Hash
      expect(described_class.to_h[:major]).to eq(2)
      expect(described_class.to_h[:minor]).to eq(0)
      expect(described_class.to_h[:patch]).to eq(4)
    end
  end

  describe '.to_a' do
    it 'returns an array with the right values' do
      expect(described_class.to_a).to be_an Array
      expect(described_class.to_a).to eq([2, 0, 4])
    end
  end

  describe '.to_s' do
    it 'returns a string with the right value' do
      expect(described_class.to_s).to be_a String
      expect(described_class.to_s).to eq('2.0.4')
    end
  end
end