startling 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8af8796ba134784e1a43a9cc6afe4206089989b
|
4
|
+
data.tar.gz: cd4fd0ad6d0a46f235acad5d66c1721cafb3cac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d77f0b239694944fca9d5cfbeb415d370c81952c23a262adecfbb7fac3839378c2ccdb10f695db4297dccf083f32ddd83fdbf35013067b7a26d8a327317b87
|
7
|
+
data.tar.gz: a13542fc2890aa0f63a873b1c6d69a72e0eb7e469105012f7e4c68cb4ad0cc3a98963587f66ddbfebbc3511b84a65c9b139fb00ff7630da204f134fa6f8306f9
|
data/lib/startling/command.rb
CHANGED
@@ -1,21 +1,36 @@
|
|
1
|
+
require 'highline/import'
|
1
2
|
require_relative "pull_request_handler_base"
|
2
3
|
|
3
4
|
module Startling
|
4
5
|
module Handlers
|
5
6
|
class DefaultPullRequestHandler < PullRequestHandlerBase
|
6
7
|
def title
|
7
|
-
title =
|
8
|
+
title = get_title
|
8
9
|
abort "Title must be specified." if title.empty?
|
9
10
|
title
|
10
11
|
end
|
11
12
|
|
12
13
|
def body
|
13
|
-
Startling.pull_request_body
|
14
|
+
(story) ? story.pull_request_body_text : Startling.pull_request_body
|
14
15
|
end
|
15
16
|
|
16
17
|
def commit_message
|
17
18
|
Startling.pull_request_commit_message
|
18
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def get_title
|
24
|
+
if story
|
25
|
+
story.pull_request_title
|
26
|
+
else
|
27
|
+
title = ask("Please input a pull request title: ")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def story
|
32
|
+
@story ||= @args.fetch(:story)
|
33
|
+
end
|
19
34
|
end
|
20
35
|
end
|
21
36
|
end
|
data/lib/startling/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'startling/handlers/default_pull_request_handler'
|
3
|
+
|
4
|
+
describe Startling::Handlers::DefaultPullRequestHandler do
|
5
|
+
let(:args) { { story: nil } }
|
6
|
+
subject { Startling::Handlers::DefaultPullRequestHandler.new(args) }
|
7
|
+
|
8
|
+
it 'returns the commit message for empty commit' do
|
9
|
+
commit_message = 'Commit message'
|
10
|
+
|
11
|
+
allow(Startling).to receive(:pull_request_commit_message) { commit_message }
|
12
|
+
|
13
|
+
expect(subject.commit_message).to eq(commit_message)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with story' do
|
17
|
+
let(:story) {
|
18
|
+
double(:story,
|
19
|
+
pull_request_title: 'Story title',
|
20
|
+
pull_request_body_text: 'Story url'
|
21
|
+
)
|
22
|
+
}
|
23
|
+
let(:args) { { story: story } }
|
24
|
+
|
25
|
+
it 'returns the story pull request title' do
|
26
|
+
expect(subject.title).to eq(story.pull_request_title)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'returns the story pull request body' do
|
30
|
+
expect(subject.body).to eq(story.pull_request_body_text)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'without story' do
|
35
|
+
it 'prompts for pull request title' do
|
36
|
+
title = 'Entered title'
|
37
|
+
|
38
|
+
allow_any_instance_of(Startling::Handlers::DefaultPullRequestHandler)
|
39
|
+
.to receive(:ask) { title }
|
40
|
+
|
41
|
+
expect(subject.title).to eq(title)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns the pull request body from configuration' do
|
45
|
+
body = 'Configured body'
|
46
|
+
|
47
|
+
allow(Startling).to receive(:pull_request_body) { body }
|
48
|
+
|
49
|
+
expect(subject.body).to eq(body)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: startling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Jensen
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- lib/startling/handlers/pull_request_handler_base.rb
|
247
247
|
- lib/startling/markdown.rb
|
248
248
|
- lib/startling/shell.rb
|
249
|
+
- lib/startling/story.rb
|
249
250
|
- lib/startling/time_format_helpers.rb
|
250
251
|
- lib/startling/version.rb
|
251
252
|
- lib/startling/work.rb
|
@@ -258,6 +259,7 @@ files:
|
|
258
259
|
- spec/startling/configuration_spec.rb
|
259
260
|
- spec/startling/git_local_spec.rb
|
260
261
|
- spec/startling/github/pull_request_spec.rb
|
262
|
+
- spec/startling/handlers/default_pull_request_handler_spec.rb
|
261
263
|
- spec/startling/time_format_helpers_spec.rb
|
262
264
|
- spec/startling_configuration_spec.rb
|
263
265
|
- spec/startling_spec.rb
|
@@ -300,6 +302,7 @@ test_files:
|
|
300
302
|
- spec/startling/configuration_spec.rb
|
301
303
|
- spec/startling/git_local_spec.rb
|
302
304
|
- spec/startling/github/pull_request_spec.rb
|
305
|
+
- spec/startling/handlers/default_pull_request_handler_spec.rb
|
303
306
|
- spec/startling/time_format_helpers_spec.rb
|
304
307
|
- spec/startling_configuration_spec.rb
|
305
308
|
- spec/startling_spec.rb
|