magnum-payload 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/magnum/payload/github.rb +1 -1
- data/lib/magnum/payload/gitlab.rb +1 -1
- data/lib/magnum/payload/version.rb +1 -1
- data/spec/fixtures/gitlab/branch_with_slash.json +34 -0
- data/spec/payload/gitlab_spec.rb +38 -26
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d392f76be98d4ea79c1d0d37f39bcfac1cb0766d
|
4
|
+
data.tar.gz: 921b9928570d5ad2f41a51d3ea3649663a1dd000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5add8ecc03c30922eb0e954e4161248cf2e7ad5f3b01b0a66f30db8fe1581dc27fb9d679687b6654b98245e6fe510ee28098bfac5c36b7a50dd20cbeb542ae6
|
7
|
+
data.tar.gz: 222df38da21cd23ee037ed1116de654b6f9813be103ab854b91686ec09f38d6d0803d52eee9db7ccb44ce6187791270b59e42f8478b5bbd718bc426ac4f36e76
|
@@ -13,7 +13,7 @@ module Magnum
|
|
13
13
|
@committer = last_commit.committer.name
|
14
14
|
@committer_email = last_commit.committer.email
|
15
15
|
@message = last_commit.message
|
16
|
-
@branch = data.ref.
|
16
|
+
@branch = data.ref.gsub("refs/heads/", "")
|
17
17
|
@commit_url = last_commit.url
|
18
18
|
@compare_url = data.compare
|
19
19
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"after": "a96a0df33262e2d2fd1b20162553aae6750f8c00",
|
3
|
+
"before": "0188ef243dd8083a4d4761766342b523d521247d",
|
4
|
+
"commits": [{
|
5
|
+
"author": {
|
6
|
+
"email": "dan.sosedoff@gmail.com",
|
7
|
+
"name": "Dan Sosedoff"
|
8
|
+
},
|
9
|
+
"id": "bce85c7015af8ff5e50bab160f8bd1aa9b2738e1",
|
10
|
+
"message": "Commit 1",
|
11
|
+
"timestamp": "2013-03-22T19:44:53+00:00",
|
12
|
+
"url": "https://gitlab.com/sosedoff/bar/commit/bce85c7015af8ff5e50bab160f8bd1aa9b2738e1"
|
13
|
+
}, {
|
14
|
+
"author": {
|
15
|
+
"email": "dan.sosedoff@gmail.com",
|
16
|
+
"name": "Dan Sosedoff"
|
17
|
+
},
|
18
|
+
"id": "a96a0df33262e2d2fd1b20162553aae6750f8c00",
|
19
|
+
"message": "Commit 2",
|
20
|
+
"timestamp": "2013-03-22T19:44:56+00:00",
|
21
|
+
"url": "https://gitlab.com/sosedoff/bar/commit/a96a0df33262e2d2fd1b20162553aae6750f8c00"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"ref": "refs/heads/issue/broken-feature",
|
25
|
+
"repository": {
|
26
|
+
"description": null,
|
27
|
+
"homepage": "https://gitlab.com/sosedoff/bar",
|
28
|
+
"name": "bar",
|
29
|
+
"url": "git@gitlab.com:sosedoff/bar.git"
|
30
|
+
},
|
31
|
+
"total_commits_count": 2,
|
32
|
+
"user_id": 3686,
|
33
|
+
"user_name": "Dan Sosedoff"
|
34
|
+
}
|
data/spec/payload/gitlab_spec.rb
CHANGED
@@ -1,52 +1,64 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Magnum::Payload::Gitlab do
|
4
|
-
let(:data) { fixture(
|
4
|
+
let(:data) { fixture("gitlab/commits.json") }
|
5
5
|
let(:payload) { Magnum::Payload::Gitlab.new(data) }
|
6
6
|
|
7
|
-
describe
|
8
|
-
it
|
9
|
-
payload.commit.
|
7
|
+
describe "#parse!" do
|
8
|
+
it "sets commit SHA" do
|
9
|
+
expect(payload.commit).to eq "a96a0df33262e2d2fd1b20162553aae6750f8c00"
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
payload.branch.
|
12
|
+
it "sets commit branch" do
|
13
|
+
expect(payload.branch).to eq "master"
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
payload.message.
|
16
|
+
it "sets commit message" do
|
17
|
+
expect(payload.message).to eq "Commit 2"
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
21
|
-
payload.
|
22
|
-
payload.author.should eq 'Dan Sosedoff'
|
20
|
+
it "sets commit author" do
|
21
|
+
expect(payload.author).to eq "Dan Sosedoff"
|
23
22
|
end
|
24
23
|
|
25
|
-
it
|
26
|
-
payload.
|
24
|
+
it "sets commit committer" do
|
25
|
+
expect(payload.committer).to eq "Dan Sosedoff"
|
27
26
|
end
|
28
27
|
|
29
|
-
it
|
30
|
-
payload.
|
28
|
+
it "sets commit view url" do
|
29
|
+
expect(payload.commit_url).
|
30
|
+
to eq "https://gitlab.com/sosedoff/bar/commit/a96a0df33262e2d2fd1b20162553aae6750f8c00"
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
it "does not set compare url" do
|
34
|
+
expect(payload.compare_url).to eq nil
|
35
|
+
end
|
36
|
+
|
37
|
+
context "on new branch" do
|
38
|
+
let(:data) { fixture("gitlab/create_branch.json") }
|
39
|
+
|
40
|
+
it "sets commit SHA" do
|
41
|
+
expect(payload.commit).to eq "0188ef243dd8083a4d4761766342b523d521247d"
|
42
|
+
end
|
35
43
|
|
36
|
-
it
|
37
|
-
payload.
|
44
|
+
it "sets branch to foobar" do
|
45
|
+
expect(payload.branch).to eq "foobar"
|
38
46
|
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "on deleted branch" do
|
50
|
+
let(:data) { fixture("gitlab/delete_branch.json") }
|
39
51
|
|
40
|
-
it
|
41
|
-
payload.
|
52
|
+
it "sets skip to true " do
|
53
|
+
expect(payload.skip).to eq true
|
42
54
|
end
|
43
55
|
end
|
44
56
|
|
45
|
-
context
|
46
|
-
let(:data) { fixture(
|
57
|
+
context "on head with slash" do
|
58
|
+
let(:data) { fixture("gitlab/branch_with_slash.json") }
|
47
59
|
|
48
|
-
it
|
49
|
-
payload.
|
60
|
+
it "returns correct branch name" do
|
61
|
+
expect(payload.branch).to eq "issue/broken-feature"
|
50
62
|
end
|
51
63
|
end
|
52
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magnum-payload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Sosedoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- spec/fixtures/github/forced.json
|
117
117
|
- spec/fixtures/github/new_branch.json
|
118
118
|
- spec/fixtures/github/new_tag.json
|
119
|
+
- spec/fixtures/gitlab/branch_with_slash.json
|
119
120
|
- spec/fixtures/gitlab/commits.json
|
120
121
|
- spec/fixtures/gitlab/create_branch.json
|
121
122
|
- spec/fixtures/gitlab/delete_branch.json
|
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
150
|
version: '0'
|
150
151
|
requirements: []
|
151
152
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.0.
|
153
|
+
rubygems_version: 2.0.3
|
153
154
|
signing_key:
|
154
155
|
specification_version: 4
|
155
156
|
summary: Code payload parser
|
@@ -165,6 +166,7 @@ test_files:
|
|
165
166
|
- spec/fixtures/github/forced.json
|
166
167
|
- spec/fixtures/github/new_branch.json
|
167
168
|
- spec/fixtures/github/new_tag.json
|
169
|
+
- spec/fixtures/gitlab/branch_with_slash.json
|
168
170
|
- spec/fixtures/gitlab/commits.json
|
169
171
|
- spec/fixtures/gitlab/create_branch.json
|
170
172
|
- spec/fixtures/gitlab/delete_branch.json
|