CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/rex/version_spec.rb
Views: 1904
1
require 'spec_helper'
2
require 'rex/version'
3
4
# rubocop:disable Lint/DeprecatedGemVersion
5
RSpec.describe Rex::Version do
6
context 'when version is nil' do
7
let(:version) { nil }
8
subject { Rex::Version.new(version) }
9
10
it 'should be equivalent to a version of 0' do
11
expect(subject).to eq Gem::Version.new(0)
12
end
13
14
it 'should be equivalent to a version of "0"' do
15
expect(subject).to eq Gem::Version.new('0')
16
end
17
18
it 'should be equivalent to a version of empty string' do
19
expect(subject).to eq Gem::Version.new('')
20
end
21
22
it 'should not be less than a version of 0' do
23
expect(subject).not_to be < Gem::Version.new(0)
24
end
25
26
it 'should not be greater than a version of 0' do
27
expect(subject).not_to be > Gem::Version.new(0)
28
end
29
30
it 'should be less than a version of "0.0.1"' do
31
expect(subject).to be < Gem::Version.new('0.0.1')
32
end
33
34
it 'should not be greater than a version of "0.0.1"' do
35
expect(subject).not_to be > Gem::Version.new('0.0.1')
36
end
37
end
38
end
39
# rubocop:enable Lint/DeprecatedGemVersion
40
41