Skip to content

Commit

Permalink
Improved VERSION; bump to 1.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
pboling committed Mar 19, 2021
1 parent 9d76cc9 commit 662e2e6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
10 changes: 7 additions & 3 deletions lib/oauth2/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OAuth2
module Version
VERSION = to_s
Expand All @@ -22,12 +24,12 @@ def minor
#
# @return [Integer]
def patch
6
7
end

# The pre-release version, if any
#
# @return [Integer, NilClass]
# @return [String, NilClass]
def pre
nil
end
Expand Down Expand Up @@ -55,7 +57,9 @@ def to_a
#
# @return [String]
def to_s
to_a.join('.')
v = [major, minor, patch].compact.join('.')
v += "-#{pre}" if pre
v
end
end
end
24 changes: 21 additions & 3 deletions spec/oauth2/version_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
describe OAuth2::Version do
it 'VERSION a sting' do
expect(OAuth2::Version::VERSION).to be_a(String)
# frozen_string_literal: true

RSpec.describe OAuth2::Version do
it 'has a version number' do
expect(described_class).not_to be nil
end

it 'can be a string' do
expect(described_class.to_s).to be_a(String)
end

it 'allows Constant access' do
expect(described_class::VERSION).to be_a(String)
end

it 'is greater than 0.1.0' do
expect(Gem::Version.new(described_class) > Gem::Version.new('0.1.0')).to be(true)
end

it 'is not a pre-release' do
expect(Gem::Version.new(described_class).prerelease?).to be(false)
end
end

0 comments on commit 662e2e6

Please sign in to comment.