spec/helpers_spec.rb in overview-0.0.5.pre.22 vs spec/helpers_spec.rb in overview-0.0.6.pre.24
- old
+ new
@@ -1,9 +1,12 @@
require 'spec_helper'
require 'helpers/ci'
require 'helpers/git'
require 'helpers/string'
+require 'helpers/sprintly'
+require 'helpers/cache'
+require 'pp'
include Helpers
RSpec.describe 'String#increment_version' do
@@ -196,10 +199,32 @@
it 'Closes #50' do
ids = Git.parse_sprintly('Closes #50')
expect(ids.first).to eq(50)
end
+ it 'Supports multiple items e.g. #50,#20' do
+ ids = Git.parse_sprintly('Closes #50,#20')
+ expect(ids.count).to eq(2)
+ expect(ids.first).to eq(50)
+ expect(ids.last).to eq(20)
+ end
+
+
+ it 'Supports multiple items e.g. #50, #20' do
+ ids = Git.parse_sprintly('Closes #50, #20')
+ expect(ids.count).to eq(2)
+ expect(ids.first).to eq(50)
+ expect(ids.last).to eq(20)
+ end
+
+ it 'Supports multiple items e.g. item:50, item:20' do
+ ids = Git.parse_sprintly('Closes item:50, item:20')
+ expect(ids.count).to eq(2)
+ expect(ids.first).to eq(50)
+ expect(ids.last).to eq(20)
+ end
+
end
RSpec.describe 'Git#commit_sha' do
it 'returns 40 characters' do
@@ -219,15 +244,53 @@
it 'returns a branch' do
expect(Git.branch.length).to be > 1
end
end
-RSpec.describe 'Git#repo' do
+RSpec.describe 'Git#parse_commit_message' do
- it 'returns a repo' do
- expect(Git.repo.length).to be > 1
+ it 'returns a populated hash' do
+ hash = Git.parse_commit_message("Fixes #1, #2 <DEPLOY #engineering This is a test>")
+ expect(hash[:deploy][:match]).to eq(true)
+ pp hash[:sprintly]
+ expect(hash[:sprintly].first).to eq(1)
+ expect(hash[:sprintly].last).to eq(2)
+
end
end
+
+
+RSpec.describe 'Sprintly#retrieveSprintlyItem' do
+ it 'returns hackpad item' do
+ cache = Cache.new
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
+ item = sprintly.sprintlyItem(1)
+
+ expect(item.hackpads.count).to eq(1)
+ end
+end
+
+RSpec.describe 'Sprintly#retrieveSprintlyItem' do
+ it 'returns sprintly item with id' do
+ cache = Cache.new
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
+ item = sprintly.sprintlyItem(1)
+ item = sprintly.sprintlyItem(1)
+
+ expect(item.id).to eq(1)
+ end
+end
+
+RSpec.describe 'Sprintly#retrieveSprintlyItem' do
+ it 'returns hackpad item' do
+ cache = Cache.new
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
+ item = sprintly.sprintlyItem(1)
+
+ expect(item.hackpads.count).to eq(1)
+ end
+end
+