This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug and add unit tests for stash payload
- Loading branch information
1 parent
10b7cf9
commit 29a36fb
Showing
7 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"repository":{"slug":"puppet-r10k","id":72,"name":"puppet-r10k","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PUP","id":81,"name":"Puppet","public":false,"type":"NORMAL"},"public":false},"refChanges":[{"refId":"refs/heads/feature_branch","fromHash":"08ea6861a4ab73facb1ca42309f295d5ceb77127","toHash":"0000000000000000000000000000000000000000","type":"DELETE"}],"changesets":{"size":0,"limit":500,"isLastPage":true,"values":[],"start":0}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"repository":{"slug":"puppet-r10k","id":72,"name":"puppet-r10k","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"PUP","id":81,"name":"Puppet","public":false,"type":"NORMAL"},"public":false},"refChanges":[{"refId":"refs/heads/feature_branch","fromHash":"6b1c3cca52bc27b3073084656186048b6d2f6a67","toHash":"08ea6861a4ab73facb1ca42309f295d5ceb77127","type":"UPDATE"}],"changesets":{"size":1,"limit":100,"isLastPage":true,"values":[{"fromCommit":{"id":"6b1c3cca52bc27b3073084656186048b6d2f6a67","displayId":"6b1c3cca52b"},"toCommit":{"id":"08ea6861a4ab73facb1ca42309f295d5ceb77127","displayId":"08ea6861a4a","author":{"name":"Alexander Fisher","emailAddress":"alex@linfratech.co.uk"},"authorTimestamp":1509707506000,"message":"a test commit","parents":[{"id":"6b1c3cca52bc27b3073084656186048b6d2f6a67","displayId":"6b1c3cca52b"}]},"changes":{"size":1,"limit":100,"isLastPage":true,"values":[{"contentId":"84fe9e3cfe2673ad3e2f024d7b7a192ba4f1b7d7","fromContentId":"056e13b19e2abd6d3cec860ec32207041e431b25","path":{"components":["README.md"],"parent":"","name":"README.md","extension":"md","toString":"README.md"},"executable":false,"percentUnchanged":-1,"type":"MODIFY","nodeType":"FILE","srcExecutable":false,"links":{"self":[{"href":"https://bitbucket.example.com/projects/PUP/repos/puppet-r10k/commits/08ea6861a4ab73facb1ca42309f295d5ceb77127#README.md"}]}}],"start":0},"links":{"self":[{"href":"https://bitbucket.example.com/projects/PUP/repos/puppet-r10k/commits/08ea6861a4ab73facb1ca42309f295d5ceb77127#README.md"}]}}],"start":0}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'spec_helper' | ||
|
||
describe Sinatra::Parsers::WebhookJsonParser do | ||
let(:result) { subject.call(payload) } | ||
context 'when payload is from stash' do | ||
describe '#call' do | ||
context 'payload is an update' do | ||
let(:payload) { read_fixture('stash/update.json') } | ||
it 'returns correctly populated params hash' do | ||
expect(result).to include( | ||
branch: 'feature_branch', | ||
deleted: false, | ||
module_name: 'r10k', | ||
repo_name: 'puppet-r10k' | ||
) | ||
end | ||
it 'doesn\'t populate repo_user' do | ||
# The stash payload doesn't contain anything we could use for repo_user | ||
expect(result).not_to include(:repo_user) | ||
end | ||
end | ||
context 'payload is for a delete' do | ||
let(:payload) { read_fixture('stash/delete.json') } | ||
it 'returns params hash with :deleted => true' do | ||
expect(result).to include(deleted: true) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters