socialcast-git-extensions 4.0.2 → 4.0.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: 5784c706b2e9ab13cc9cb0793eef1374131cd6a6
4
- data.tar.gz: 91050a88b4d54f39203c1f267340c08e36e8f9ca
3
+ metadata.gz: 3767f1d18028006484c0399aacf57067ae198ce5
4
+ data.tar.gz: 09f38ffe0daf1e52ba7e0c242da0520be3191f91
5
5
  SHA512:
6
- metadata.gz: ce188906d313943102989e695fbbaad526990906a04e19129f8d9fbd2bb01aec7179b8177fcf138818b8ab5a884da0dd9a5242b284d7f84ed6afecb21f4ec7eb
7
- data.tar.gz: a2dc3af241d2c141d7d0d0c337e5fc9a7a86d5b70777ec1fb160e7c8e72d44b1f9fb99219270f5dffb66f7526b8e18b351ff8830f6087a3df69d30b0639b088c
6
+ metadata.gz: be5541c5509cbd74353435416f2eab6c327b595ade0bf45a09721d2bd9a8b9370271f8192ffef1b9019ba4bc4c05255e63a5580afca57af7c73664acd77557b7
7
+ data.tar.gz: 78ff784cef68a76418fd9a05f98fc609c554482d6339ec77fca4a921922045ec53bb641a9ff263054a2498c8759caae57d05b9ce684be37435cbfdb100a2124a
@@ -34,6 +34,12 @@ module Socialcast
34
34
  def createpr
35
35
  update unless @skip_update
36
36
  description = options[:description] || editor_input(PULL_REQUEST_DESCRIPTION)
37
+
38
+ if use_pr_comments?
39
+ creator_socialcast_username = Socialcast::CommandLine::Authenticate.current_user['username'] rescue nil
40
+ description = "#{description}\n\nCreated by @#{creator_socialcast_username}" if creator_socialcast_username
41
+ end
42
+
37
43
  branch = current_branch
38
44
  repo = current_repo
39
45
  url = create_pull_request(branch, repo, description)['html_url']
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "4.0.2"
3
+ VERSION = "4.0.3"
4
4
  end
5
5
  end
data/spec/cli_spec.rb CHANGED
@@ -1123,6 +1123,10 @@ describe Socialcast::Gitx::CLI do
1123
1123
  .with(:body => pr_comment_body)
1124
1124
  .to_return(:status => 200, :body => "{}", :headers => {})
1125
1125
  end
1126
+ let(:stub_get_socialcast_user) do
1127
+ stub_request(:get, "https://testuser:testpassword@testdomain/api/userinfo.json")
1128
+ .to_return(:status => 200, :body => '{"username": "TestUsername"}', :headers => {})
1129
+ end
1126
1130
  let(:use_pr_comments) { false }
1127
1131
  before do
1128
1132
  stub_github_create_pr_comment
@@ -1148,6 +1152,9 @@ describe Socialcast::Gitx::CLI do
1148
1152
  end
1149
1153
  context 'when use_pr_comments? is true' do
1150
1154
  let(:use_pr_comments) { true }
1155
+ before do
1156
+ stub_get_socialcast_user
1157
+ end
1151
1158
  it do
1152
1159
  Socialcast::Gitx::CLI.start ['reviewrequest', '--description', 'testing', '-s']
1153
1160
 
@@ -1155,6 +1162,7 @@ describe Socialcast::Gitx::CLI do
1155
1162
  expect(github_create_pr).to have_been_requested
1156
1163
  expect(github_find_pr_for_branch).to have_been_requested
1157
1164
 
1165
+ expect(stub_get_socialcast_user).to have_been_requested
1158
1166
  expect(stub_github_create_pr_comment).to have_been_requested
1159
1167
  end
1160
1168
  end
@@ -1183,6 +1191,9 @@ describe Socialcast::Gitx::CLI do
1183
1191
  end
1184
1192
  context 'when use_pr_comments? is true' do
1185
1193
  let(:use_pr_comments) { true }
1194
+ before do
1195
+ stub_get_socialcast_user
1196
+ end
1186
1197
  it do
1187
1198
  Socialcast::Gitx::CLI.start ['reviewrequest', '--description', 'testing', '-a', 'a']
1188
1199
 
@@ -1190,6 +1201,7 @@ describe Socialcast::Gitx::CLI do
1190
1201
  expect(github_create_pr).to have_been_requested
1191
1202
  expect(github_assign_pr).to have_been_requested
1192
1203
 
1204
+ expect(stub_get_socialcast_user).to have_been_requested
1193
1205
  expect(stub_github_create_pr_comment).to have_been_requested
1194
1206
  end
1195
1207
  end
@@ -1212,10 +1224,15 @@ describe Socialcast::Gitx::CLI do
1212
1224
  end
1213
1225
  context 'when use_pr_comments? is true' do
1214
1226
  let(:use_pr_comments) { true }
1227
+ before do
1228
+ stub_get_socialcast_user
1229
+ end
1215
1230
  it do
1216
1231
  Socialcast::Gitx::CLI.start ['reviewrequest', '--description', 'testing', '-s']
1217
1232
  expect(github_create_pr).to have_been_requested
1218
1233
  expect(github_assign_pr).to have_been_requested
1234
+
1235
+ expect(stub_get_socialcast_user).to have_been_requested
1219
1236
  expect(stub_github_create_pr_comment).to have_been_requested
1220
1237
  end
1221
1238
  end
@@ -1234,10 +1251,14 @@ describe Socialcast::Gitx::CLI do
1234
1251
  end
1235
1252
  context 'when use_pr_comments? is true' do
1236
1253
  let(:use_pr_comments) { true }
1254
+ before do
1255
+ stub_get_socialcast_user
1256
+ end
1237
1257
  it do
1238
1258
  Socialcast::Gitx::CLI.start ['reviewrequest', '--description', 'testing', '-s']
1239
1259
  expect(github_create_pr).to have_been_requested
1240
1260
  expect(github_assign_pr).to have_been_requested
1261
+ expect(stub_get_socialcast_user).to have_been_requested
1241
1262
  expect(stub_github_create_pr_comment).to have_been_requested
1242
1263
  end
1243
1264
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Socialcast
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged