spec/appversion_spec.rb in overview-0.0.2.1.40 vs spec/appversion_spec.rb in overview-0.0.2.43
- old
+ new
@@ -1,17 +1,47 @@
require 'spec_helper'
require 'appversion/ci'
+require 'appversion/git'
+
RSpec.describe '#build_no' do
- include Overview
+ include Overview
- context 'running on CI' do
- it 'returns build number' do
- build_no = ENV['TRAVIS_BUILD_NUMBER'] || ENV['CIRCLE_BUILD_NUM'] || '1'
- expect(Overview::CI.build_no).to eq(build_no)
- end
+ it 'returns build number' do
+ build_no = ENV['TRAVIS_BUILD_NUMBER'] || ENV['CIRCLE_BUILD_NUM'] || '1'
+ expect(Overview::CI.build_no).to eq(build_no)
+ end
+end
- end
+RSpec.describe '#clean_tag' do
+ it '1.2.3-rc4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2.3-rc4')).to eq('1.2.3')
+ end
+ it '1.2-rc4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2-rc4')).to eq('1.2')
+ end
+ it '1.2-rc4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2-rc4')).to eq('1.2')
+ end
+ it '1.2.3 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2.3')).to eq('1.2.3')
+ end
+ it '1.2.3.4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2.3.4')).to eq('1.2.3')
+ end
+ it '1.2.rc4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2.rc4')).to eq('1.2')
+ end
+ it '1.2.3.rc4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.2.3.rc4')).to eq('1.2.3')
+ end
+ it '1.rc4 returns semantic version' do
+ expect(Overview::Git.clean_tag('1.rc4')).to eq('1')
+ end
+ it '1 returns semantic version' do
+ expect(Overview::Git.clean_tag('1')).to eq('1')
+ end
+end
-end
\ No newline at end of file
+