Skip to content

Commit 6c70994

Browse files
author
Inbal Tako
committed
Fix version parsing
1 parent 12a7a5c commit 6c70994

3 files changed

Lines changed: 24 additions & 16 deletions

File tree

Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ GEM
7373
crack (0.4.3)
7474
safe_yaml (~> 1.0.0)
7575
crass (1.0.6)
76-
diff-lcs (1.3)
76+
diff-lcs (1.4.4)
7777
docile (1.3.2)
7878
dry-configurable (0.11.6)
7979
concurrent-ruby (~> 1.0)
@@ -207,19 +207,19 @@ GEM
207207
rake (>= 0.8.7)
208208
thor (>= 0.20.3, < 2.0)
209209
rake (13.0.1)
210-
rspec (3.8.0)
211-
rspec-core (~> 3.8.0)
212-
rspec-expectations (~> 3.8.0)
213-
rspec-mocks (~> 3.8.0)
214-
rspec-core (3.8.2)
215-
rspec-support (~> 3.8.0)
216-
rspec-expectations (3.8.4)
210+
rspec (3.9.0)
211+
rspec-core (~> 3.9.0)
212+
rspec-expectations (~> 3.9.0)
213+
rspec-mocks (~> 3.9.0)
214+
rspec-core (3.9.2)
215+
rspec-support (~> 3.9.3)
216+
rspec-expectations (3.9.2)
217217
diff-lcs (>= 1.2.0, < 2.0)
218-
rspec-support (~> 3.8.0)
219-
rspec-mocks (3.8.1)
218+
rspec-support (~> 3.9.0)
219+
rspec-mocks (3.9.1)
220220
diff-lcs (>= 1.2.0, < 2.0)
221-
rspec-support (~> 3.8.0)
222-
rspec-support (3.8.2)
221+
rspec-support (~> 3.9.0)
222+
rspec-support (3.9.3)
223223
ruby2_keywords (0.0.2)
224224
safe_yaml (1.0.5)
225225
simplecov (0.19.0)

lib/utils/version_utils.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
class VersionUtils
44
def self.version
55
begin
6-
spec = Gem::Specification.load('securenative.gemspec')
7-
version = spec.version.to_s
6+
Gem.loaded_specs['securenative'].version.to_s
87
rescue StandardError
9-
version = 'unknown'
8+
'unknown'
109
end
11-
version
1210
end
1311
end

spec/spec_version_util.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
require 'utils/version_utils'
4+
require 'rspec'
5+
6+
RSpec.describe VersionUtils do
7+
it 'checks that parsing version is valid' do
8+
expect(VersionUtils.version).not_to eq('unknown')
9+
end
10+
end

0 commit comments

Comments
 (0)