pulsar 0.3.5 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +150 -0
  5. data/.ruby-version +1 -1
  6. data/LICENSE.txt +1 -1
  7. data/README.md +4 -265
  8. data/bin/pulsar +1 -1
  9. data/circle.yml +22 -0
  10. data/lib/pulsar.rb +28 -7
  11. data/lib/pulsar/cli.rb +79 -0
  12. data/lib/pulsar/constants.rb +5 -0
  13. data/lib/pulsar/generators/initial_repo/Gemfile +3 -0
  14. data/lib/pulsar/generators/{init_repo → initial_repo}/README.md +1 -1
  15. data/lib/pulsar/generators/initial_repo/apps/Capfile +8 -0
  16. data/lib/pulsar/generators/initial_repo/apps/deploy.rb +35 -0
  17. data/lib/pulsar/generators/initial_repo/apps/your_app/Capfile +18 -0
  18. data/lib/pulsar/generators/initial_repo/apps/your_app/deploy.rb +4 -0
  19. data/lib/pulsar/generators/initial_repo/apps/your_app/production.rb +3 -0
  20. data/lib/pulsar/generators/initial_repo/apps/your_app/staging.rb +3 -0
  21. data/lib/pulsar/generators/initial_repo/recipes/generic/rake.rake +12 -0
  22. data/lib/pulsar/generators/{init_repo/apps/your_app/recipes/production → initial_repo/recipes/rails}/.gitkeep +0 -0
  23. data/lib/pulsar/interactors/add_applications.rb +48 -0
  24. data/lib/pulsar/interactors/cleanup.rb +9 -0
  25. data/lib/pulsar/interactors/clone_repository.rb +50 -0
  26. data/lib/pulsar/interactors/copy_environment_file.rb +30 -0
  27. data/lib/pulsar/interactors/copy_initial_repository.rb +22 -0
  28. data/lib/pulsar/interactors/create_capfile.rb +32 -0
  29. data/lib/pulsar/interactors/create_deploy_file.rb +32 -0
  30. data/lib/pulsar/interactors/create_run_dirs.rb +21 -0
  31. data/lib/pulsar/interactors/identify_repository_location.rb +23 -0
  32. data/lib/pulsar/interactors/identify_repository_type.rb +34 -0
  33. data/lib/pulsar/interactors/run_bundle_install.rb +28 -0
  34. data/lib/pulsar/interactors/run_capistrano.rb +30 -0
  35. data/lib/pulsar/organizers/deploy.rb +16 -0
  36. data/lib/pulsar/organizers/install.rb +7 -0
  37. data/lib/pulsar/organizers/list.rb +12 -0
  38. data/lib/pulsar/version.rb +1 -1
  39. data/pulsar.gemspec +13 -11
  40. data/spec/features/deploy_spec.rb +162 -0
  41. data/spec/features/install_spec.rb +66 -0
  42. data/spec/features/list_spec.rb +140 -0
  43. data/spec/spec_helper.rb +26 -14
  44. data/{lib/pulsar/generators/init_repo/apps/your_app/recipes/staging → spec/support/dummies}/.gitkeep +0 -0
  45. data/spec/support/dummies/conf/dir/Gemfile +3 -0
  46. data/spec/support/dummies/conf/dir/apps/Capfile +9 -0
  47. data/spec/support/dummies/conf/dir/apps/blog/Capfile +1 -0
  48. data/spec/support/dummies/conf/dir/apps/blog/deploy.rb +4 -0
  49. data/spec/support/dummies/conf/dir/apps/blog/production.rb +4 -0
  50. data/spec/support/dummies/conf/dir/apps/blog/staging.rb +4 -0
  51. data/spec/support/dummies/conf/dir/apps/deploy.rb +1 -0
  52. data/{lib/pulsar/generators/init_repo/recipes/rails/.gitkeep → spec/support/dummies/conf/dir/apps/ecommerce/staging.rb} +0 -0
  53. data/spec/support/dummies/conf/dir/recipes/.gitkeep +0 -0
  54. data/spec/support/dummies/conf/dotenv +1 -0
  55. data/spec/support/dummies/conf/empty/apps/.gitkeep +0 -0
  56. data/spec/support/dummies/conf/empty/recipes/.gitkeep +0 -0
  57. data/spec/support/dummies/conf/wrong_bundle/Gemfile +3 -0
  58. data/spec/support/dummies/conf/wrong_bundle/apps/Capfile +9 -0
  59. data/spec/support/dummies/conf/wrong_bundle/apps/blog/Capfile +1 -0
  60. data/spec/support/dummies/conf/wrong_bundle/apps/blog/deploy.rb +4 -0
  61. data/spec/support/dummies/conf/wrong_bundle/apps/blog/production.rb +4 -0
  62. data/spec/support/dummies/conf/wrong_bundle/apps/deploy.rb +1 -0
  63. data/spec/support/dummies/conf/wrong_bundle/recipes/.gitkeep +0 -0
  64. data/spec/support/dummies/conf/wrong_cap/Gemfile +3 -0
  65. data/spec/support/dummies/conf/wrong_cap/apps/Capfile +0 -0
  66. data/spec/support/dummies/conf/wrong_cap/apps/blog/deploy.rb +4 -0
  67. data/spec/support/dummies/conf/wrong_cap/apps/blog/production.rb +4 -0
  68. data/spec/support/dummies/conf/wrong_cap/apps/deploy.rb +1 -0
  69. data/spec/support/dummies/conf/wrong_cap/recipes/.gitkeep +0 -0
  70. data/spec/units/cli/deploy_spec.rb +116 -0
  71. data/spec/units/cli/install_spec.rb +44 -0
  72. data/spec/units/cli/list_spec.rb +107 -0
  73. data/spec/units/constants_spec.rb +21 -0
  74. data/spec/units/interactors/add_applications_spec.rb +46 -0
  75. data/spec/units/interactors/cleanup_spec.rb +21 -0
  76. data/spec/units/interactors/clone_initial_repository_spec.rb +41 -0
  77. data/spec/units/interactors/clone_repository_spec.rb +122 -0
  78. data/spec/units/interactors/copy_environment_file_spec.rb +80 -0
  79. data/spec/units/interactors/create_capfile_spec.rb +77 -0
  80. data/spec/units/interactors/create_deploy_file_spec.rb +70 -0
  81. data/spec/units/interactors/create_run_dirs_spec.rb +47 -0
  82. data/spec/units/interactors/identify_repository_location_spec.rb +49 -0
  83. data/spec/units/interactors/identify_repository_type_spec.rb +85 -0
  84. data/spec/units/interactors/run_bundle_install_spec.rb +60 -0
  85. data/spec/units/interactors/run_capistrano_spec.rb +92 -0
  86. data/spec/units/organizers/deploy_spec.rb +28 -0
  87. data/spec/units/organizers/install_spec.rb +13 -0
  88. data/spec/units/organizers/list_spec.rb +24 -0
  89. metadata +179 -106
  90. data/.ruby-gemset +0 -1
  91. data/.travis.yml +0 -17
  92. data/bin/pulsar-utils +0 -5
  93. data/lib/pulsar/commands/all.rb +0 -6
  94. data/lib/pulsar/commands/init.rb +0 -23
  95. data/lib/pulsar/commands/list.rb +0 -19
  96. data/lib/pulsar/commands/main.rb +0 -64
  97. data/lib/pulsar/commands/utils.rb +0 -14
  98. data/lib/pulsar/generators/init_repo/Gemfile +0 -7
  99. data/lib/pulsar/generators/init_repo/apps/base.rb +0 -41
  100. data/lib/pulsar/generators/init_repo/apps/your_app/defaults.rb +0 -9
  101. data/lib/pulsar/generators/init_repo/apps/your_app/production.rb +0 -12
  102. data/lib/pulsar/generators/init_repo/apps/your_app/recipes/custom_recipe.rb +0 -14
  103. data/lib/pulsar/generators/init_repo/apps/your_app/staging.rb +0 -12
  104. data/lib/pulsar/generators/init_repo/recipes/generic/cleanup.rb +0 -50
  105. data/lib/pulsar/generators/init_repo/recipes/generic/utils.rb +0 -9
  106. data/lib/pulsar/helpers/all.rb +0 -8
  107. data/lib/pulsar/helpers/capistrano.rb +0 -47
  108. data/lib/pulsar/helpers/clamp.rb +0 -223
  109. data/lib/pulsar/helpers/path.rb +0 -71
  110. data/lib/pulsar/helpers/shell.rb +0 -31
  111. data/lib/pulsar/options/all.rb +0 -6
  112. data/lib/pulsar/options/conf_repo.rb +0 -41
  113. data/lib/pulsar/options/shared.rb +0 -15
  114. data/spec/pulsar/commands/init_spec.rb +0 -10
  115. data/spec/pulsar/commands/list_spec.rb +0 -127
  116. data/spec/pulsar/commands/main_spec.rb +0 -360
  117. data/spec/pulsar/commands/utils_spec.rb +0 -33
  118. data/spec/pulsar/helpers/capistrano_spec.rb +0 -70
  119. data/spec/pulsar/helpers/clamp_spec.rb +0 -105
  120. data/spec/pulsar/helpers/shell_spec.rb +0 -11
  121. data/spec/support/dummies/dummy_app/config.ru +0 -3
  122. data/spec/support/dummies/dummy_conf/Gemfile +0 -4
  123. data/spec/support/dummies/dummy_conf/apps/base.rb +0 -46
  124. data/spec/support/dummies/dummy_conf/apps/dummy_app/custom_stage.rb +0 -5
  125. data/spec/support/dummies/dummy_conf/apps/dummy_app/defaults.rb +0 -7
  126. data/spec/support/dummies/dummy_conf/apps/dummy_app/production.rb +0 -5
  127. data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/custom_recipe.rb +0 -1
  128. data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/production/custom_recipe.rb +0 -1
  129. data/spec/support/dummies/dummy_conf/apps/dummy_app/recipes/staging/custom_recipe.rb +0 -1
  130. data/spec/support/dummies/dummy_conf/apps/dummy_app/staging.rb +0 -5
  131. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/custom_stage.rb +0 -5
  132. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/defaults.rb +0 -7
  133. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/production.rb +0 -5
  134. data/spec/support/dummies/dummy_conf/apps/other_dummy_app/staging.rb +0 -5
  135. data/spec/support/dummies/dummy_conf/recipes/generic/recipe.rb +0 -3
  136. data/spec/support/modules/helpers.rb +0 -85
  137. data/spec/support/modules/output_capture.rb +0 -21
@@ -0,0 +1,77 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::CreateCapfile do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.call' do
9
+ subject { command }
10
+
11
+ let(:command) { described_class.call(args) }
12
+ let(:cap_path) { "#{Pulsar::PULSAR_TMP}/cap-path" }
13
+ let(:args) do
14
+ {
15
+ config_path: RSpec.configuration.pulsar_conf_path,
16
+ cap_path: cap_path, application: 'blog'
17
+ }
18
+ end
19
+
20
+ before { FileUtils.mkdir_p(cap_path) }
21
+
22
+ context 'success' do
23
+ it { is_expected.to be_a_success }
24
+
25
+ context 'creates a Capfile' do
26
+ subject { File }
27
+
28
+ it { is_expected.to exist(command.capfile_path) }
29
+
30
+ context 'with the required Capistrano path' do
31
+ subject { command.capfile_path }
32
+
33
+ it { is_expected.to eql "#{cap_path}/Capfile" }
34
+ end
35
+
36
+ context 'with contents combined from pulsar configuration repo' do
37
+ subject { File.read(command.capfile_path) }
38
+
39
+ let(:load_recipes) do
40
+ "Dir.glob(\"#{RSpec.configuration.pulsar_conf_path}/recipes/**/*.rake\").each { |r| import r }"
41
+ end
42
+
43
+ it { is_expected.to match(/# Defaults Capfile.*# App Defaults Capfile/m) }
44
+ it { is_expected.to include(load_recipes) }
45
+ end
46
+ end
47
+ end
48
+
49
+ context 'failure' do
50
+ context 'when no config_path context is passed' do
51
+ subject { described_class.call }
52
+
53
+ it { is_expected.to be_a_failure }
54
+ end
55
+
56
+ context 'when no application context is passed' do
57
+ subject { described_class.call(config_path: './my-conf') }
58
+
59
+ it { is_expected.to be_a_failure }
60
+ end
61
+
62
+ context 'when no cap_path context is passed' do
63
+ subject do
64
+ described_class.call(config_path: './my-conf', application: 'blog')
65
+ end
66
+
67
+ it { is_expected.to be_a_failure }
68
+ end
69
+
70
+ context 'when an exception is triggered' do
71
+ before { allow(FileUtils).to receive(:touch).and_raise(RuntimeError) }
72
+
73
+ it { is_expected.to be_a_failure }
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::CreateDeployFile do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.call' do
9
+ subject { command }
10
+
11
+ let(:command) { described_class.call(args) }
12
+ let(:cap_path) { "#{Pulsar::PULSAR_TMP}/cap-path" }
13
+ let(:args) do
14
+ {
15
+ config_path: RSpec.configuration.pulsar_conf_path,
16
+ cap_path: cap_path, application: 'blog'
17
+ }
18
+ end
19
+
20
+ context 'success' do
21
+ it { is_expected.to be_a_success }
22
+
23
+ context 'creates a Capfile' do
24
+ subject { File }
25
+
26
+ it { is_expected.to exist(command.deploy_file_path) }
27
+
28
+ context 'with the required Capistrano path' do
29
+ subject { command.deploy_file_path }
30
+
31
+ it { is_expected.to eql "#{cap_path}/config/deploy.rb" }
32
+ end
33
+
34
+ context 'with contents combined from pulsar configuration repo' do
35
+ subject { File.read(command.deploy_file_path) }
36
+
37
+ it { is_expected.to match(/# Defaults deployrb\n# App Defaults deployrb/) }
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'failure' do
43
+ context 'when no config_path context is passed' do
44
+ subject { described_class.call }
45
+
46
+ it { is_expected.to be_a_failure }
47
+ end
48
+
49
+ context 'when no application context is passed' do
50
+ subject { described_class.call(config_path: './my-conf') }
51
+
52
+ it { is_expected.to be_a_failure }
53
+ end
54
+
55
+ context 'when no cap_path context is passed' do
56
+ subject do
57
+ described_class.call(config_path: './my-conf', application: 'blog')
58
+ end
59
+
60
+ it { is_expected.to be_a_failure }
61
+ end
62
+
63
+ context 'when an exception is triggered' do
64
+ before { allow(FileUtils).to receive(:touch).and_raise(RuntimeError) }
65
+
66
+ it { is_expected.to be_a_failure }
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::CreateRunDirs do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.success' do
9
+ around do |example|
10
+ Timecop.freeze { example.run }
11
+ end
12
+
13
+ context 'uses a timestamp' do
14
+ subject { described_class.call.timestamp }
15
+
16
+ it { is_expected.to eql Time.now.to_f }
17
+ end
18
+
19
+ context 'creates some folders' do
20
+ subject { File }
21
+
22
+ let(:command) { described_class.call }
23
+
24
+ it { is_expected.to be_directory("#{Pulsar::PULSAR_HOME}/bundle") }
25
+ it { is_expected.to be_directory(command.bundle_path) }
26
+ it { is_expected.to be_directory(command.run_path) }
27
+ it { is_expected.to be_directory(command.config_path) }
28
+ it { is_expected.to be_directory(command.cap_path) }
29
+ end
30
+ end
31
+
32
+ describe '.rollback' do
33
+ subject { FileUtils }
34
+
35
+ let(:run_path) { '~/.pulsar/tmp/run' }
36
+
37
+ before do
38
+ allow(subject).to receive(:rm_rf)
39
+ allow_any_instance_of(Interactor::Context)
40
+ .to receive(:run_path).and_return(run_path)
41
+
42
+ described_class.new.rollback
43
+ end
44
+
45
+ it { is_expected.to have_received(:rm_rf).with(run_path) }
46
+ end
47
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::IdentifyRepositoryLocation do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.call' do
9
+ subject { described_class.call(repository: repo) }
10
+
11
+ let(:repo) { './my-conf' }
12
+
13
+ context 'success' do
14
+ before { allow(File).to receive(:exist?) }
15
+
16
+ it { is_expected.to be_a_success }
17
+
18
+ context 'when the repository' do
19
+ subject { described_class.call(repository: repo).repository_location }
20
+
21
+ context 'is a local folder' do
22
+ before { allow(File).to receive(:exist?).and_return(true) }
23
+
24
+ it { is_expected.to eql :local }
25
+ end
26
+
27
+ context 'is a local git repository' do
28
+ before { allow(File).to receive(:exist?).and_return(false) }
29
+
30
+ it { is_expected.to eql :remote }
31
+ end
32
+ end
33
+ end
34
+
35
+ context 'failure' do
36
+ context 'when no repository context is passed' do
37
+ subject { described_class.call }
38
+
39
+ it { is_expected.to be_a_failure }
40
+ end
41
+
42
+ context 'when an exception is triggered' do
43
+ before { allow(File).to receive(:exist?).and_raise(RuntimeError) }
44
+
45
+ it { is_expected.to be_a_failure }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::IdentifyRepositoryType do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.call' do
9
+ subject { described_class.call(args) }
10
+
11
+ let(:repo) { './my-conf' }
12
+ let(:location) { :local }
13
+ let(:args) { { repository: repo, repository_location: location } }
14
+
15
+ context 'success' do
16
+ context 'when local' do
17
+ before do
18
+ expect(Rake)
19
+ .to receive(:sh).with("git -C #{repo} status >/dev/null 2>&1")
20
+ end
21
+
22
+ it { is_expected.to be_a_success }
23
+
24
+ context 'the configuration repository' do
25
+ subject { described_class.call(args).repository_type }
26
+
27
+ context 'is a folder' do
28
+ before { allow(Rake).to receive(:sh).and_return(false) }
29
+
30
+ it { is_expected.to eql :folder }
31
+ end
32
+
33
+ context 'is a git repository' do
34
+ before do
35
+ allow(Rake).to receive(:sh).and_return(true)
36
+ allow(File).to receive(:exist?).and_return(true)
37
+ end
38
+
39
+ it { is_expected.to eql :git }
40
+ end
41
+ end
42
+ end
43
+
44
+ context 'when remote' do
45
+ let(:location) { :remote }
46
+
47
+ it { is_expected.to be_a_success }
48
+
49
+ context 'the configuration repository' do
50
+ subject { described_class.call(args).repository_type }
51
+
52
+ context 'is a git repository' do
53
+ it { is_expected.to eql :git }
54
+ end
55
+
56
+ context 'is a GitHub repository' do
57
+ let(:repo) { 'github-account/my-conf' }
58
+
59
+ it { is_expected.to eql :github }
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ context 'failure' do
66
+ context 'when no repository context is passed' do
67
+ subject { described_class.call(repository_location: :local) }
68
+
69
+ it { is_expected.to be_a_failure }
70
+ end
71
+
72
+ context 'when no repository_location context is passed' do
73
+ subject { described_class.call(repository: repo) }
74
+
75
+ it { is_expected.to be_a_failure }
76
+ end
77
+
78
+ context 'when an exception is triggered' do
79
+ before { allow(Rake).to receive(:sh).and_raise(RuntimeError) }
80
+
81
+ it { is_expected.to be_a_failure }
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::RunBundleInstall do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.success' do
9
+ subject do
10
+ described_class.new(config_path: './config-path', bundle_path: './bundle-path')
11
+ end
12
+
13
+ let(:bundle_env) do
14
+ 'BUNDLE_GEMFILE=./config-path/Gemfile BUNDLE_PATH=./bundle-path'
15
+ end
16
+ let(:bundle_install_cmd) do
17
+ "#{bundle_env} bundle check || #{bundle_env} bundle install"
18
+ end
19
+
20
+ before do
21
+ allow(subject).to receive(:system)
22
+ subject.run
23
+ end
24
+
25
+ it { is_expected.to have_received(:system).with(bundle_install_cmd) }
26
+ end
27
+
28
+ context 'failure' do
29
+ context 'when no context is passed' do
30
+ subject { described_class.call }
31
+
32
+ it { is_expected.to be_a_failure }
33
+ end
34
+
35
+ context 'when no config_path context is passed' do
36
+ subject { described_class.call(bundle_path: './some-path') }
37
+
38
+ it { is_expected.to be_a_failure }
39
+ end
40
+
41
+ context 'when no bundle_path context is passed' do
42
+ subject { described_class.call(config_path: './some-path') }
43
+
44
+ it { is_expected.to be_a_failure }
45
+ end
46
+
47
+ context 'when an exception is triggered' do
48
+ subject do
49
+ described_class.new(config_path: './config-path', bundle_path: './bundle-path')
50
+ end
51
+
52
+ before do
53
+ allow(subject).to receive(:system).and_raise(RuntimeError)
54
+ subject.run
55
+ end
56
+
57
+ it { expect(subject.context).to be_a_failure }
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,92 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Pulsar::RunCapistrano do
4
+ subject { described_class.new }
5
+
6
+ it { is_expected.to be_kind_of(Interactor) }
7
+
8
+ describe '.success' do
9
+ subject do
10
+ described_class.new(
11
+ cap_path: RSpec.configuration.pulsar_conf_path, config_path: './config-path',
12
+ bundle_path: './bundle-path', environment: 'production'
13
+ )
14
+ end
15
+
16
+ let(:cap_cmd) { "cap production deploy" }
17
+ let(:bundle_cmd) do
18
+ "BUNDLE_GEMFILE=./config-path/Gemfile BUNDLE_PATH=./bundle-path bundle exec"
19
+ end
20
+
21
+ before do
22
+ allow(subject).to receive(:system)
23
+ subject.run
24
+ end
25
+
26
+ it { is_expected.to have_received(:system).with("#{bundle_cmd} #{cap_cmd}") }
27
+ end
28
+
29
+ context 'failure' do
30
+ context 'when no context is passed' do
31
+ subject { described_class.call }
32
+
33
+ it { is_expected.to be_a_failure }
34
+ end
35
+
36
+ context 'when no cap_path context is passed' do
37
+ subject do
38
+ described_class.call(
39
+ config_path: './config-path', bundle_path: './bundle-path',
40
+ environment: 'production'
41
+ )
42
+ end
43
+
44
+ it { is_expected.to be_a_failure }
45
+ end
46
+
47
+ context 'when no environment context is passed' do
48
+ subject do
49
+ described_class.call(
50
+ cap_path: './cap-path', config_path: './config-path',
51
+ bundle_path: './bundle-path'
52
+ )
53
+ end
54
+
55
+ it { is_expected.to be_a_failure }
56
+ end
57
+ context 'when no bundle_path context is passed' do
58
+ subject do
59
+ described_class.call(
60
+ cap_path: './cap-path', config_path: './config-path',
61
+ environment: 'production'
62
+ )
63
+ end
64
+
65
+ it { is_expected.to be_a_failure }
66
+ end
67
+
68
+ context 'when no config_path context is passed' do
69
+ subject do
70
+ described_class.call(
71
+ cap_path: './cap-path', environment: 'production',
72
+ bundle_path: './bundle-path'
73
+ )
74
+ end
75
+
76
+ it { is_expected.to be_a_failure }
77
+ end
78
+
79
+ context 'when an exception is triggered' do
80
+ subject do
81
+ described_class.call(
82
+ cap_path: './cap-path', config_path: './config-path',
83
+ bundle_path: './bundle-path', environment: 'production'
84
+ )
85
+ end
86
+
87
+ before { allow(Dir).to receive(:chdir).and_raise(RuntimeError) }
88
+
89
+ it { is_expected.to be_a_failure }
90
+ end
91
+ end
92
+ end