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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a93c18d82f5039aabc7a14c75291693117f92b6d
4
- data.tar.gz: 9f6d4a32fe5b2b047e4f178bf172ff7c056f0c86
3
+ metadata.gz: d392f76be98d4ea79c1d0d37f39bcfac1cb0766d
4
+ data.tar.gz: 921b9928570d5ad2f41a51d3ea3649663a1dd000
5
5
  SHA512:
6
- metadata.gz: b8f22f02913bb97c4f030ad0da10d95476c01d595aa952c2426ec873fe5aaab786232fa3e48c7fe786b951b0e393a773bd4ef8b6cca028e447f2b956b204c436
7
- data.tar.gz: 5ff86b1468c19eae47943c59b52d56f464443e4254237affa3fbd2cb5e13f44bf3ade649b629631b6aac203043e3ba666e74692e504df0be3894cd6c5ab622f9
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.split('/').last
16
+ @branch = data.ref.gsub("refs/heads/", "")
17
17
  @commit_url = last_commit.url
18
18
  @compare_url = data.compare
19
19
  end
@@ -14,7 +14,7 @@ module Magnum
14
14
 
15
15
  def assign_payload
16
16
  @commit = data.after
17
- @branch = data.ref.split('/').last
17
+ @branch = data.ref.gsub("refs/heads/", "")
18
18
 
19
19
  if data.commits.any?
20
20
  @author = last_commit.author.name
@@ -1,5 +1,5 @@
1
1
  module Magnum
2
2
  module Payload
3
- VERSION = '0.3.2'
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  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
+ }
@@ -1,52 +1,64 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Magnum::Payload::Gitlab do
4
- let(:data) { fixture('gitlab/commits.json') }
4
+ let(:data) { fixture("gitlab/commits.json") }
5
5
  let(:payload) { Magnum::Payload::Gitlab.new(data) }
6
6
 
7
- describe '#parse!' do
8
- it 'sets commit SHA' do
9
- payload.commit.should eq 'a96a0df33262e2d2fd1b20162553aae6750f8c00'
7
+ describe "#parse!" do
8
+ it "sets commit SHA" do
9
+ expect(payload.commit).to eq "a96a0df33262e2d2fd1b20162553aae6750f8c00"
10
10
  end
11
11
 
12
- it 'sets commit branch' do
13
- payload.branch.should eq 'master'
12
+ it "sets commit branch" do
13
+ expect(payload.branch).to eq "master"
14
14
  end
15
15
 
16
- it 'sets commit message' do
17
- payload.message.should eq 'Commit 2'
16
+ it "sets commit message" do
17
+ expect(payload.message).to eq "Commit 2"
18
18
  end
19
19
 
20
- it 'sets author and committer' do
21
- payload.committer.should eq 'Dan Sosedoff'
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 'sets commit view url' do
26
- payload.commit_url.should eq 'https://gitlab.com/sosedoff/bar/commit/a96a0df33262e2d2fd1b20162553aae6750f8c00'
24
+ it "sets commit committer" do
25
+ expect(payload.committer).to eq "Dan Sosedoff"
27
26
  end
28
27
 
29
- it 'does not set compare url' do
30
- payload.compare_url.should eq nil
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
- context 'on new branch' do
34
- let(:data) { fixture('gitlab/create_branch.json') }
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 'sets commit SHA' do
37
- payload.commit.should eq '0188ef243dd8083a4d4761766342b523d521247d'
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 'sets branch to foobar' do
41
- payload.branch.should eq 'foobar'
52
+ it "sets skip to true " do
53
+ expect(payload.skip).to eq true
42
54
  end
43
55
  end
44
56
 
45
- context 'on deleted branch' do
46
- let(:data) { fixture('gitlab/delete_branch.json') }
57
+ context "on head with slash" do
58
+ let(:data) { fixture("gitlab/branch_with_slash.json") }
47
59
 
48
- it 'sets skip to true ' do
49
- payload.skip.should eq true
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.2
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-08-24 00:00:00.000000000 Z
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.5
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