File: version_spec.rb

package info (click to toggle)
ruby-twitter 7.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,840 kB
  • sloc: ruby: 10,919; makefile: 6
file content (34 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download | duplicates (3)
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
34
require 'helper'

describe Twitter::Version do
  before do
    allow(Twitter::Version).to receive(:major).and_return(1)
    allow(Twitter::Version).to receive(:minor).and_return(2)
    allow(Twitter::Version).to receive(:patch).and_return(3)
    allow(Twitter::Version).to receive(:pre).and_return(nil)
  end

  describe '.to_h' do
    it 'returns a hash with the right values' do
      expect(Twitter::Version.to_h).to be_a Hash
      expect(Twitter::Version.to_h[:major]).to eq(1)
      expect(Twitter::Version.to_h[:minor]).to eq(2)
      expect(Twitter::Version.to_h[:patch]).to eq(3)
      expect(Twitter::Version.to_h[:pre]).to eq(nil)
    end
  end

  describe '.to_a' do
    it 'returns an array with the right values' do
      expect(Twitter::Version.to_a).to be_an Array
      expect(Twitter::Version.to_a).to eq([1, 2, 3])
    end
  end

  describe '.to_s' do
    it 'returns a string with the right value' do
      expect(Twitter::Version.to_s).to be_a String
      expect(Twitter::Version.to_s).to eq('1.2.3')
    end
  end
end