File: sys_platform_spec.rb

package info (click to toggle)
ruby-sys-uname 1.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: ruby: 1,093; makefile: 4
file content (64 lines) | stat: -rw-r--r-- 2,099 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true

##############################################################################
# sys_platform_spec.rb
#
# Test suite for the Sys::Platform class.
##############################################################################
require 'spec_helper'

RSpec.describe Sys::Platform do
  example 'the VERSION constant is set to the expected value' do
    expect(Sys::Platform::VERSION).to eql('1.5.0')
    expect(Sys::Platform::VERSION).to be_frozen
  end

  example 'the ARCH constant is defined' do
    expect(Sys::Platform::ARCH).to be_a(Symbol)
  end

  example 'the OS constant is defined' do
    expect(Sys::Platform::OS).to be_a(Symbol)
  end

  example 'the IMPL constant is defined' do
    expect(Sys::Platform::IMPL).to be_a(Symbol)
  end

  example 'the IMPL returns an expected value on windows', :windows do
    expect(%i[mingw mswin]).to include(Sys::Platform::IMPL)
  end

  example 'the mac? method is defined and returns a boolean' do
    expect(described_class).to respond_to(:mac?)
    expect(described_class.mac?).to eql(true).or eql(false)
  end

  example 'the windows? method is defined and returns a boolean' do
    expect(described_class).to respond_to(:windows?)
    expect(described_class.windows?).to eql(true).or eql(false)
  end

  example 'the windows? method returns the expected value' do
    expect(described_class.windows?).to eql(Gem.win_platform?)
  end

  example 'the unix? method is defined and returns a boolean' do
    expect(described_class).to respond_to(:unix?)
    expect(described_class.unix?).to eql(true).or eql(false)
  end

  example 'the unix? method returns the expected value' do
    expect(described_class.unix?).not_to eql(Gem.win_platform?)
  end

  example 'the linux? method is defined and returns a boolean' do
    expect(described_class).to respond_to(:linux?)
    expect(described_class.linux?).to eql(true).or eql(false)
  end

  example 'the bsd? method is defined and returns a boolean' do
    expect(described_class).to respond_to(:bsd?)
    expect(described_class.bsd?).to eql(true).or eql(false)
  end
end