git_reflow 0.8.9 → 0.8.10
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 +5 -5
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +41 -44
- data/README.md +461 -0
- data/_config.yml +1 -0
- data/circle.yml +5 -5
- data/exe/git-reflow +36 -36
- data/git_reflow.gemspec +6 -11
- data/lib/git_reflow.rb +0 -1
- data/lib/git_reflow/git_server.rb +63 -63
- data/lib/git_reflow/git_server/bit_bucket.rb +101 -101
- data/lib/git_reflow/git_server/bit_bucket/pull_request.rb +84 -84
- data/lib/git_reflow/git_server/git_hub.rb +1 -1
- data/lib/git_reflow/git_server/git_hub/pull_request.rb +1 -1
- data/lib/git_reflow/rspec.rb +2 -2
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow/workflows/core.rb +235 -238
- data/lib/git_reflow/workflows/flat_merge.rb +10 -10
- data/spec/fixtures/awesome_workflow.rb +7 -7
- data/spec/fixtures/workflow_with_super.rb +8 -8
- data/spec/lib/git_reflow/git_server/bit_bucket_spec.rb +81 -81
- data/spec/lib/git_reflow/git_server/git_hub/pull_request_spec.rb +4 -4
- data/spec/lib/git_reflow/git_server_spec.rb +101 -101
- data/spec/lib/git_reflow/sandbox_spec.rb +1 -1
- data/spec/lib/git_reflow/workflow_spec.rb +59 -59
- data/spec/lib/git_reflow/workflows/core_spec.rb +3 -4
- data/spec/lib/git_reflow/workflows/flat_merge_spec.rb +60 -59
- data/spec/support/fixtures.rb +54 -54
- data/spec/support/github_helpers.rb +99 -109
- metadata +17 -39
- data/README.rdoc +0 -461
- data/lib/git_reflow/os_detector.rb +0 -23
@@ -1,10 +1,10 @@
|
|
1
|
-
class FlatMerge < GitReflow::Workflows::Core
|
2
|
-
def self.deliver(**params)
|
3
|
-
base_branch = params[:base] || 'master'
|
4
|
-
params[:squash] = false
|
5
|
-
|
6
|
-
super(**params)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
FlatMerge
|
1
|
+
class FlatMerge < GitReflow::Workflows::Core
|
2
|
+
def self.deliver(**params)
|
3
|
+
base_branch = params[:base] || 'master'
|
4
|
+
params[:squash] = false
|
5
|
+
|
6
|
+
super(**params)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
FlatMerge
|
@@ -1,7 +1,7 @@
|
|
1
|
-
class AwesomeWorkflow < GitReflow::Workflows::Core
|
2
|
-
def self.start(**args)
|
3
|
-
GitReflow.say "Awesome."
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
AwesomeWorkflow
|
1
|
+
class AwesomeWorkflow < GitReflow::Workflows::Core
|
2
|
+
def self.start(**args)
|
3
|
+
GitReflow.say "Awesome."
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
AwesomeWorkflow
|
@@ -1,8 +1,8 @@
|
|
1
|
-
class WorkflowWithSuper < GitReflow::Workflows::Core
|
2
|
-
def self.start(**args)
|
3
|
-
GitReflow.say "Super."
|
4
|
-
super(feature_branch: args[:feature_branch], base: args[:base])
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
WorkflowWithSuper
|
1
|
+
class WorkflowWithSuper < GitReflow::Workflows::Core
|
2
|
+
def self.start(**args)
|
3
|
+
GitReflow.say "Super."
|
4
|
+
super(feature_branch: args[:feature_branch], base: args[:base])
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
WorkflowWithSuper
|
@@ -1,81 +1,81 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe GitReflow::GitServer::BitBucket do
|
4
|
-
let(:user) { 'reenhanced' }
|
5
|
-
let(:password) { 'shazam' }
|
6
|
-
let(:repo) { 'repo' }
|
7
|
-
let(:api_key) { 'a1b2c3d4e5f6g7h8i9j0' }
|
8
|
-
let(:hostname) { 'hostname.local' }
|
9
|
-
let(:api_endpoint) { 'https://bitbucket.org/api/1.0' }
|
10
|
-
let(:site) { 'https://bitbucket.org' }
|
11
|
-
let(:remote_url) { "git@bitbucket.org:#{user}/#{repo}.git" }
|
12
|
-
|
13
|
-
before do
|
14
|
-
allow_any_instance_of(HighLine).to receive(:ask) do |terminal, question|
|
15
|
-
values = {
|
16
|
-
"Please enter your BitBucket username: " => user
|
17
|
-
}
|
18
|
-
return_value = values[question]
|
19
|
-
question = ""
|
20
|
-
return_value
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#initialize(options)' do
|
25
|
-
subject { GitReflow::GitServer::BitBucket.new({}) }
|
26
|
-
|
27
|
-
it 'sets the reflow git server provider to BitBucket in the git config' do
|
28
|
-
expect(GitReflow::Config).to receive(:set).once.with('reflow.git-server', 'BitBucket', local: false)
|
29
|
-
subject
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'storing git config settings only for this project' do
|
33
|
-
subject { GitReflow::GitServer::BitBucket.new(project_only: true) }
|
34
|
-
|
35
|
-
it 'sets the enterprise site and api as the site and api endpoints for the BitBucket provider in the git config' do
|
36
|
-
expect(GitReflow::Config).to receive(:set).once.with('reflow.git-server', 'BitBucket', local: true)
|
37
|
-
subject
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#authenticate' do
|
44
|
-
let(:bitbucket) { GitReflow::GitServer::BitBucket.new( { }) }
|
45
|
-
let!(:bitbucket_api) { BitBucket.new }
|
46
|
-
subject { bitbucket.authenticate }
|
47
|
-
|
48
|
-
context 'already authenticated' do
|
49
|
-
it "notifies the user of successful setup" do
|
50
|
-
allow(GitReflow::Config).to receive(:set).with('reflow.git-server', 'BitBucket', local: false)
|
51
|
-
allow(GitReflow::Config).to receive(:get).with('remote.origin.url').and_return(remote_url)
|
52
|
-
allow(GitReflow::Config).to receive(:get).with('bitbucket.user', local: false).and_return(user)
|
53
|
-
allow(GitReflow::Config).to receive(:get).with('bitbucket.api-key', reload: true, local: false).and_return(api_key)
|
54
|
-
allow(GitReflow::Config).to receive(:get).with('reflow.local-projects', all: true).and_return('')
|
55
|
-
expect { subject }.to have_said "\nYour BitBucket account was already setup with:"
|
56
|
-
expect { subject }.to have_said "\tUser Name: #{user}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'not yet authenticated' do
|
61
|
-
context 'with valid BitBucket credentials' do
|
62
|
-
before do
|
63
|
-
allow(GitReflow::Config).to receive(:get).and_return('')
|
64
|
-
allow(GitReflow::Config).to receive(:set)
|
65
|
-
allow(GitReflow::Config).to receive(:set).with('bitbucket.api-key', reload: true).and_return(api_key)
|
66
|
-
allow(GitReflow::Config).to receive(:get).with('bitbucket.api-key', reload: true).and_return('')
|
67
|
-
allow(GitReflow::Config).to receive(:get).with('remote.origin.url').and_return(remote_url)
|
68
|
-
allow(GitReflow::Config).to receive(:get).with('reflow.local-projects').and_return('')
|
69
|
-
allow(bitbucket).to receive(:connection).and_return double(repos: double(all: []))
|
70
|
-
end
|
71
|
-
|
72
|
-
it "prompts me to setup an API key" do
|
73
|
-
expect { subject }.to have_said "\nIn order to connect your BitBucket account,"
|
74
|
-
expect { subject }.to have_said "you'll need to generate an API key for your team"
|
75
|
-
expect { subject }.to have_said "Visit https://bitbucket.org/account/user/reenhanced/api-key/, to generate it\n"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GitReflow::GitServer::BitBucket do
|
4
|
+
let(:user) { 'reenhanced' }
|
5
|
+
let(:password) { 'shazam' }
|
6
|
+
let(:repo) { 'repo' }
|
7
|
+
let(:api_key) { 'a1b2c3d4e5f6g7h8i9j0' }
|
8
|
+
let(:hostname) { 'hostname.local' }
|
9
|
+
let(:api_endpoint) { 'https://bitbucket.org/api/1.0' }
|
10
|
+
let(:site) { 'https://bitbucket.org' }
|
11
|
+
let(:remote_url) { "git@bitbucket.org:#{user}/#{repo}.git" }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow_any_instance_of(HighLine).to receive(:ask) do |terminal, question|
|
15
|
+
values = {
|
16
|
+
"Please enter your BitBucket username: " => user
|
17
|
+
}
|
18
|
+
return_value = values[question]
|
19
|
+
question = ""
|
20
|
+
return_value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#initialize(options)' do
|
25
|
+
subject { GitReflow::GitServer::BitBucket.new({}) }
|
26
|
+
|
27
|
+
it 'sets the reflow git server provider to BitBucket in the git config' do
|
28
|
+
expect(GitReflow::Config).to receive(:set).once.with('reflow.git-server', 'BitBucket', local: false)
|
29
|
+
subject
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'storing git config settings only for this project' do
|
33
|
+
subject { GitReflow::GitServer::BitBucket.new(project_only: true) }
|
34
|
+
|
35
|
+
it 'sets the enterprise site and api as the site and api endpoints for the BitBucket provider in the git config' do
|
36
|
+
expect(GitReflow::Config).to receive(:set).once.with('reflow.git-server', 'BitBucket', local: true)
|
37
|
+
subject
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#authenticate' do
|
44
|
+
let(:bitbucket) { GitReflow::GitServer::BitBucket.new( { }) }
|
45
|
+
let!(:bitbucket_api) { BitBucket.new }
|
46
|
+
subject { bitbucket.authenticate }
|
47
|
+
|
48
|
+
context 'already authenticated' do
|
49
|
+
it "notifies the user of successful setup" do
|
50
|
+
allow(GitReflow::Config).to receive(:set).with('reflow.git-server', 'BitBucket', local: false)
|
51
|
+
allow(GitReflow::Config).to receive(:get).with('remote.origin.url').and_return(remote_url)
|
52
|
+
allow(GitReflow::Config).to receive(:get).with('bitbucket.user', local: false).and_return(user)
|
53
|
+
allow(GitReflow::Config).to receive(:get).with('bitbucket.api-key', reload: true, local: false).and_return(api_key)
|
54
|
+
allow(GitReflow::Config).to receive(:get).with('reflow.local-projects', all: true).and_return('')
|
55
|
+
expect { subject }.to have_said "\nYour BitBucket account was already setup with:"
|
56
|
+
expect { subject }.to have_said "\tUser Name: #{user}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'not yet authenticated' do
|
61
|
+
context 'with valid BitBucket credentials' do
|
62
|
+
before do
|
63
|
+
allow(GitReflow::Config).to receive(:get).and_return('')
|
64
|
+
allow(GitReflow::Config).to receive(:set)
|
65
|
+
allow(GitReflow::Config).to receive(:set).with('bitbucket.api-key', reload: true).and_return(api_key)
|
66
|
+
allow(GitReflow::Config).to receive(:get).with('bitbucket.api-key', reload: true).and_return('')
|
67
|
+
allow(GitReflow::Config).to receive(:get).with('remote.origin.url').and_return(remote_url)
|
68
|
+
allow(GitReflow::Config).to receive(:get).with('reflow.local-projects').and_return('')
|
69
|
+
allow(bitbucket).to receive(:connection).and_return double(repos: double(all: []))
|
70
|
+
end
|
71
|
+
|
72
|
+
it "prompts me to setup an API key" do
|
73
|
+
expect { subject }.to have_said "\nIn order to connect your BitBucket account,"
|
74
|
+
expect { subject }.to have_said "you'll need to generate an API key for your team"
|
75
|
+
expect { subject }.to have_said "Visit https://bitbucket.org/account/user/reenhanced/api-key/, to generate it\n"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -490,10 +490,10 @@ describe GitReflow::GitServer::GitHub::PullRequest do
|
|
490
490
|
context "and force-merging" do
|
491
491
|
let(:inputs) do
|
492
492
|
{
|
493
|
-
base:
|
494
|
-
title:
|
495
|
-
message:
|
496
|
-
|
493
|
+
base: "base_branch",
|
494
|
+
title: "title",
|
495
|
+
message: "message",
|
496
|
+
force: true
|
497
497
|
}
|
498
498
|
end
|
499
499
|
|
@@ -1,101 +1,101 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe GitReflow::GitServer do
|
4
|
-
let(:connection_options) { nil }
|
5
|
-
|
6
|
-
subject { GitReflow::GitServer.connect connection_options }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(GitReflow::GitServer::GitHub).to receive(:new)
|
10
|
-
|
11
|
-
module GitReflow::GitServer
|
12
|
-
class DummyHub < Base
|
13
|
-
def initialize(options)
|
14
|
-
"Initialized with #{options}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def authenticate(options={})
|
18
|
-
end
|
19
|
-
|
20
|
-
def connection
|
21
|
-
'Connected!'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '.connect(options)' do
|
28
|
-
it 'initializes a new GitHub server provider by default' do
|
29
|
-
stubbed_github = Class.new
|
30
|
-
allow(stubbed_github).to receive(:authenticate)
|
31
|
-
expect(GitReflow::GitServer::GitHub).to receive(:new).and_return(stubbed_github)
|
32
|
-
subject
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'provider is specified' do
|
36
|
-
let(:connection_options) { {provider: 'DummyHub'}.merge(expected_server_options) }
|
37
|
-
let(:expected_server_options) {{ basic_auth: 'user:pass', end_point: 'https://api.example.com' }}
|
38
|
-
|
39
|
-
it 'initializes any server provider that has been implemented' do
|
40
|
-
dummy_hub = GitReflow::GitServer::DummyHub.new({})
|
41
|
-
expect(GitReflow::GitServer::DummyHub).to receive(:new).with(expected_server_options).and_return(dummy_hub)
|
42
|
-
expect(subject).to eq(dummy_hub)
|
43
|
-
expect($says).not_to include 'GitServer not setup for: DummyHub'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'provider not yet implemented' do
|
48
|
-
let(:connection_options) {{ provider: 'GitLab' }}
|
49
|
-
it { expect{ subject }.to have_said "Error connecting to GitLab: GitServer not setup for \"GitLab\"", :error }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '.current_provider' do
|
54
|
-
subject { GitReflow::GitServer.current_provider }
|
55
|
-
|
56
|
-
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server', local: true).and_return(nil) }
|
57
|
-
|
58
|
-
context 'Reflow setup to use GitHub' do
|
59
|
-
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GitHub') }
|
60
|
-
it { is_expected.to eq(GitReflow::GitServer::GitHub) }
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'Reflow has not yet been setup' do
|
64
|
-
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('') }
|
65
|
-
it { is_expected.to be_nil }
|
66
|
-
it { expect{ subject }.to have_said "Reflow hasn't been setup yet. Run 'git reflow setup' to continue", :notice }
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'an unknown server provider is stored in the git config' do
|
70
|
-
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GittyUp') }
|
71
|
-
|
72
|
-
it { is_expected.to be_nil }
|
73
|
-
it { expect{ subject }.to have_said "GitServer not setup for \"GittyUp\"", :error }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '.connection' do
|
78
|
-
subject { GitReflow::GitServer.connection }
|
79
|
-
|
80
|
-
before do
|
81
|
-
allow(GitReflow::Config).to receive(:get).with('reflow.git-server', local: true).and_return(nil)
|
82
|
-
allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return(nil)
|
83
|
-
end
|
84
|
-
|
85
|
-
it { is_expected.to be_nil }
|
86
|
-
|
87
|
-
context "with a valid provider" do
|
88
|
-
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GitHub') }
|
89
|
-
it 'calls connection on the provider' do
|
90
|
-
expect(GitReflow::GitServer::GitHub).to receive(:connection)
|
91
|
-
subject
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context "with an invalid provider" do
|
96
|
-
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GittyUp') }
|
97
|
-
it { is_expected.to be_nil }
|
98
|
-
it { expect{ subject }.to have_said "GitServer not setup for \"GittyUp\"", :error }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GitReflow::GitServer do
|
4
|
+
let(:connection_options) { nil }
|
5
|
+
|
6
|
+
subject { GitReflow::GitServer.connect connection_options }
|
7
|
+
|
8
|
+
before do
|
9
|
+
allow(GitReflow::GitServer::GitHub).to receive(:new)
|
10
|
+
|
11
|
+
module GitReflow::GitServer
|
12
|
+
class DummyHub < Base
|
13
|
+
def initialize(options)
|
14
|
+
"Initialized with #{options}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def authenticate(options={})
|
18
|
+
end
|
19
|
+
|
20
|
+
def connection
|
21
|
+
'Connected!'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '.connect(options)' do
|
28
|
+
it 'initializes a new GitHub server provider by default' do
|
29
|
+
stubbed_github = Class.new
|
30
|
+
allow(stubbed_github).to receive(:authenticate)
|
31
|
+
expect(GitReflow::GitServer::GitHub).to receive(:new).and_return(stubbed_github)
|
32
|
+
subject
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'provider is specified' do
|
36
|
+
let(:connection_options) { {provider: 'DummyHub'}.merge(expected_server_options) }
|
37
|
+
let(:expected_server_options) {{ basic_auth: 'user:pass', end_point: 'https://api.example.com' }}
|
38
|
+
|
39
|
+
it 'initializes any server provider that has been implemented' do
|
40
|
+
dummy_hub = GitReflow::GitServer::DummyHub.new({})
|
41
|
+
expect(GitReflow::GitServer::DummyHub).to receive(:new).with(expected_server_options).and_return(dummy_hub)
|
42
|
+
expect(subject).to eq(dummy_hub)
|
43
|
+
expect($says).not_to include 'GitServer not setup for: DummyHub'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'provider not yet implemented' do
|
48
|
+
let(:connection_options) {{ provider: 'GitLab' }}
|
49
|
+
it { expect{ subject }.to have_said "Error connecting to GitLab: GitServer not setup for \"GitLab\"", :error }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '.current_provider' do
|
54
|
+
subject { GitReflow::GitServer.current_provider }
|
55
|
+
|
56
|
+
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server', local: true).and_return(nil) }
|
57
|
+
|
58
|
+
context 'Reflow setup to use GitHub' do
|
59
|
+
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GitHub') }
|
60
|
+
it { is_expected.to eq(GitReflow::GitServer::GitHub) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'Reflow has not yet been setup' do
|
64
|
+
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('') }
|
65
|
+
it { is_expected.to be_nil }
|
66
|
+
it { expect{ subject }.to have_said "Reflow hasn't been setup yet. Run 'git reflow setup' to continue", :notice }
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'an unknown server provider is stored in the git config' do
|
70
|
+
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GittyUp') }
|
71
|
+
|
72
|
+
it { is_expected.to be_nil }
|
73
|
+
it { expect{ subject }.to have_said "GitServer not setup for \"GittyUp\"", :error }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '.connection' do
|
78
|
+
subject { GitReflow::GitServer.connection }
|
79
|
+
|
80
|
+
before do
|
81
|
+
allow(GitReflow::Config).to receive(:get).with('reflow.git-server', local: true).and_return(nil)
|
82
|
+
allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return(nil)
|
83
|
+
end
|
84
|
+
|
85
|
+
it { is_expected.to be_nil }
|
86
|
+
|
87
|
+
context "with a valid provider" do
|
88
|
+
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GitHub') }
|
89
|
+
it 'calls connection on the provider' do
|
90
|
+
expect(GitReflow::GitServer::GitHub).to receive(:connection)
|
91
|
+
subject
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "with an invalid provider" do
|
96
|
+
before { allow(GitReflow::Config).to receive(:get).with('reflow.git-server').and_return('GittyUp') }
|
97
|
+
it { is_expected.to be_nil }
|
98
|
+
it { expect{ subject }.to have_said "GitServer not setup for \"GittyUp\"", :error }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -9,7 +9,7 @@ RSpec.describe GitReflow::Sandbox do
|
|
9
9
|
|
10
10
|
it "when blocking is flagged off, the command exits silently" do
|
11
11
|
allow(GitReflow::Sandbox).to receive(:run).and_call_original
|
12
|
-
expect { GitReflow::Sandbox.run("ls wtf", blocking: false) }.to_not raise_error
|
12
|
+
expect { GitReflow::Sandbox.run("ls wtf", blocking: false) }.to_not raise_error
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,59 +1,59 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe GitReflow::Workflow do
|
4
|
-
|
5
|
-
class DummyWorkflow
|
6
|
-
include GitReflow::Workflow
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:workflow) { DummyWorkflow }
|
10
|
-
let(:loader) { double() }
|
11
|
-
|
12
|
-
describe ".current" do
|
13
|
-
subject { GitReflow::Workflow.current }
|
14
|
-
|
15
|
-
context "when no workflow is set" do
|
16
|
-
before { allow(GitReflow::Config).to receive(:get).with("reflow.workflow").and_return('') }
|
17
|
-
specify { expect( subject ).to eql(GitReflow::Workflows::Core) }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "when a workflow is set" do
|
21
|
-
let(:workflow_path) { File.join(File.expand_path("../../../fixtures", __FILE__), "/awesome_workflow.rb") }
|
22
|
-
|
23
|
-
before { allow(GitReflow::Config).to receive(:get).with("reflow.workflow").and_return(workflow_path) }
|
24
|
-
specify { expect( subject ).to eql(GitReflow::Workflow::AwesomeWorkflow) }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe ".command" do
|
29
|
-
it "creates a class method for a bogus command" do
|
30
|
-
class DummyWorkflow
|
31
|
-
include GitReflow::Workflow
|
32
|
-
end
|
33
|
-
workflow.command :bogus do
|
34
|
-
"Woohoo"
|
35
|
-
end
|
36
|
-
|
37
|
-
expect(DummyWorkflow.bogus).to eql("Woohoo")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "creates a method for a bogus command with arguments" do
|
41
|
-
workflow.command :bogus, arguments: [:feature_branch] do |**params|
|
42
|
-
"Woohoo #{params[:feature_branch]}!"
|
43
|
-
end
|
44
|
-
|
45
|
-
expect(DummyWorkflow.bogus(feature_branch: "donuts")).to eql("Woohoo donuts!")
|
46
|
-
end
|
47
|
-
|
48
|
-
it "creates a class method for a bogus command with default options" do
|
49
|
-
workflow.command :bogus, arguments: [:feature_branch], defaults: {decoration: 'sprinkles'} do |**params|
|
50
|
-
donut_excitement = "Woohoo #{params[:feature_branch]}"
|
51
|
-
donut_excitement += " with #{params[:decoration]}" if params[:decoration]
|
52
|
-
"#{donut_excitement}!"
|
53
|
-
end
|
54
|
-
|
55
|
-
expect(DummyWorkflow.bogus(feature_branch: "donuts")).to eql("Woohoo donuts with sprinkles!")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GitReflow::Workflow do
|
4
|
+
|
5
|
+
class DummyWorkflow
|
6
|
+
include GitReflow::Workflow
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:workflow) { DummyWorkflow }
|
10
|
+
let(:loader) { double() }
|
11
|
+
|
12
|
+
describe ".current" do
|
13
|
+
subject { GitReflow::Workflow.current }
|
14
|
+
|
15
|
+
context "when no workflow is set" do
|
16
|
+
before { allow(GitReflow::Config).to receive(:get).with("reflow.workflow").and_return('') }
|
17
|
+
specify { expect( subject ).to eql(GitReflow::Workflows::Core) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "when a workflow is set" do
|
21
|
+
let(:workflow_path) { File.join(File.expand_path("../../../fixtures", __FILE__), "/awesome_workflow.rb") }
|
22
|
+
|
23
|
+
before { allow(GitReflow::Config).to receive(:get).with("reflow.workflow").and_return(workflow_path) }
|
24
|
+
specify { expect( subject ).to eql(GitReflow::Workflow::AwesomeWorkflow) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".command" do
|
29
|
+
it "creates a class method for a bogus command" do
|
30
|
+
class DummyWorkflow
|
31
|
+
include GitReflow::Workflow
|
32
|
+
end
|
33
|
+
workflow.command :bogus do
|
34
|
+
"Woohoo"
|
35
|
+
end
|
36
|
+
|
37
|
+
expect(DummyWorkflow.bogus).to eql("Woohoo")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "creates a method for a bogus command with arguments" do
|
41
|
+
workflow.command :bogus, arguments: [:feature_branch] do |**params|
|
42
|
+
"Woohoo #{params[:feature_branch]}!"
|
43
|
+
end
|
44
|
+
|
45
|
+
expect(DummyWorkflow.bogus(feature_branch: "donuts")).to eql("Woohoo donuts!")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "creates a class method for a bogus command with default options" do
|
49
|
+
workflow.command :bogus, arguments: [:feature_branch], defaults: {decoration: 'sprinkles'} do |**params|
|
50
|
+
donut_excitement = "Woohoo #{params[:feature_branch]}"
|
51
|
+
donut_excitement += " with #{params[:decoration]}" if params[:decoration]
|
52
|
+
"#{donut_excitement}!"
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(DummyWorkflow.bogus(feature_branch: "donuts")).to eql("Woohoo donuts with sprinkles!")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|