producer-core 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/lib/producer/core/version.rb +1 -1
  3. metadata +21 -202
  4. data/.gitignore +0 -3
  5. data/.travis.yml +0 -14
  6. data/Gemfile +0 -5
  7. data/Guardfile +0 -14
  8. data/LICENSE +0 -30
  9. data/Rakefile +0 -19
  10. data/config/cucumber.yaml +0 -2
  11. data/features/actions/echo.feature +0 -11
  12. data/features/actions/file_append.feature +0 -15
  13. data/features/actions/file_replace_content.feature +0 -24
  14. data/features/actions/file_write.feature +0 -21
  15. data/features/actions/mkdir.feature +0 -31
  16. data/features/actions/sh.feature +0 -43
  17. data/features/actions/yaml_write.feature +0 -14
  18. data/features/cli/debug.feature +0 -19
  19. data/features/cli/dry_run.feature +0 -22
  20. data/features/cli/error_reporting.feature +0 -32
  21. data/features/cli/target.feature +0 -15
  22. data/features/cli/usage.feature +0 -13
  23. data/features/cli/verbose.feature +0 -48
  24. data/features/condition/negated_test.feature +0 -47
  25. data/features/condition/target.feature +0 -15
  26. data/features/recipe/compose_macro.feature +0 -29
  27. data/features/recipe/errors.feature +0 -9
  28. data/features/recipe/macro.feature +0 -50
  29. data/features/recipe/registry.feature +0 -82
  30. data/features/recipe/source.feature +0 -17
  31. data/features/recipe/target.feature +0 -23
  32. data/features/recipe/test_macro.feature +0 -50
  33. data/features/ssh/config.feature +0 -25
  34. data/features/steps/environment_steps.rb +0 -3
  35. data/features/support/env.rb +0 -1
  36. data/features/task/ask.feature +0 -23
  37. data/features/task/condition.feature +0 -13
  38. data/features/task/nested_tasks.feature +0 -20
  39. data/features/task/recipe_argv.feature +0 -13
  40. data/features/task/target.feature +0 -11
  41. data/features/task/template.feature +0 -49
  42. data/features/tests/dir.feature +0 -21
  43. data/features/tests/env.feature +0 -47
  44. data/features/tests/executable.feature +0 -26
  45. data/features/tests/file.feature +0 -21
  46. data/features/tests/file_contains.feature +0 -26
  47. data/features/tests/file_eq.feature +0 -26
  48. data/features/tests/file_match.feature +0 -26
  49. data/features/tests/shell_command_status.feature +0 -46
  50. data/features/tests/yaml_eq.feature +0 -26
  51. data/producer-core.gemspec +0 -28
  52. data/spec/fixtures/recipes/empty.rb +0 -1
  53. data/spec/fixtures/recipes/raise.rb +0 -1
  54. data/spec/fixtures/recipes/some_recipe.rb +0 -5
  55. data/spec/fixtures/recipes/throw.rb +0 -1
  56. data/spec/fixtures/templates/basic.erb +0 -1
  57. data/spec/fixtures/templates/basic_yaml.yaml +0 -1
  58. data/spec/fixtures/templates/variables.erb +0 -1
  59. data/spec/producer/core/action_spec.rb +0 -46
  60. data/spec/producer/core/actions/echo_spec.rb +0 -20
  61. data/spec/producer/core/actions/file_append_spec.rb +0 -49
  62. data/spec/producer/core/actions/file_replace_content_spec.rb +0 -42
  63. data/spec/producer/core/actions/file_writer_spec.rb +0 -52
  64. data/spec/producer/core/actions/mkdir_spec.rb +0 -71
  65. data/spec/producer/core/actions/shell_command_spec.rb +0 -45
  66. data/spec/producer/core/actions/yaml_writer_spec.rb +0 -25
  67. data/spec/producer/core/cli_spec.rb +0 -211
  68. data/spec/producer/core/condition_spec.rb +0 -198
  69. data/spec/producer/core/env_spec.rb +0 -196
  70. data/spec/producer/core/error_formatter_spec.rb +0 -86
  71. data/spec/producer/core/logger_formatter_spec.rb +0 -26
  72. data/spec/producer/core/prompter_spec.rb +0 -40
  73. data/spec/producer/core/recipe/file_evaluator_spec.rb +0 -22
  74. data/spec/producer/core/recipe_spec.rb +0 -126
  75. data/spec/producer/core/remote/environment_spec.rb +0 -19
  76. data/spec/producer/core/remote/fs_spec.rb +0 -144
  77. data/spec/producer/core/remote_spec.rb +0 -168
  78. data/spec/producer/core/task_spec.rb +0 -198
  79. data/spec/producer/core/template_spec.rb +0 -41
  80. data/spec/producer/core/test_spec.rb +0 -7
  81. data/spec/producer/core/testing/mock_remote_spec.rb +0 -66
  82. data/spec/producer/core/tests/condition_test_spec.rb +0 -55
  83. data/spec/producer/core/tests/file_contains_spec.rb +0 -46
  84. data/spec/producer/core/tests/file_eq_spec.rb +0 -45
  85. data/spec/producer/core/tests/file_match_spec.rb +0 -46
  86. data/spec/producer/core/tests/has_dir_spec.rb +0 -25
  87. data/spec/producer/core/tests/has_env_spec.rb +0 -75
  88. data/spec/producer/core/tests/has_executable_spec.rb +0 -29
  89. data/spec/producer/core/tests/has_file_spec.rb +0 -25
  90. data/spec/producer/core/tests/shell_command_status_spec.rb +0 -34
  91. data/spec/producer/core/tests/yaml_eq_spec.rb +0 -47
  92. data/spec/producer/core/worker_spec.rb +0 -88
  93. data/spec/spec_helper.rb +0 -13
  94. data/spec/support/exit_helpers.rb +0 -6
  95. data/spec/support/fixtures_helpers.rb +0 -7
  96. data/spec/support/net_ssh_story_helpers.rb +0 -36
  97. data/spec/support/shared_action.rb +0 -44
  98. data/spec/support/shared_test.rb +0 -82
  99. data/spec/support/test_env_helpers.rb +0 -44
@@ -1,198 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- describe Task do
5
- class SomeAction < Action; end
6
-
7
- let(:env) { Env.new }
8
- let(:name) { :some_task }
9
- let(:condition) { :some_condition }
10
- subject(:task) { described_class.new(env, name, [], condition) }
11
-
12
- %w[
13
- echo
14
- sh
15
- mkdir
16
- file_append
17
- file_replace_content
18
- file_write
19
- ].each do |action|
20
- it "has `#{action}' action defined" do
21
- expect(task).to respond_to action.to_sym
22
- end
23
- end
24
-
25
- describe '.define_action' do
26
- before { described_class.define_action(:some_action, SomeAction) }
27
-
28
- it 'defines a new action keyword' do
29
- expect(task).to respond_to :some_action
30
- end
31
-
32
- context 'when an action keyword is called' do
33
- it 'registers the action' do
34
- expect { task.some_action }.to change { task.actions.count }.by 1
35
- end
36
-
37
- it 'registers the action with current env' do
38
- task.some_action
39
- expect(task.actions.first.env).to be env
40
- end
41
-
42
- it 'registers the action with given arguments' do
43
- task.some_action :foo, :bar
44
- expect(task.actions.first.arguments).to eq %i[foo bar]
45
- end
46
- end
47
- end
48
-
49
- describe '.evaluate' do
50
- let(:code) { proc { condition { :condition }; some_action } }
51
- let(:arguments) { [] }
52
- subject(:task) { described_class.evaluate(env, name, *arguments, &code) }
53
-
54
- before { described_class.define_action(:some_action, SomeAction) }
55
-
56
- it 'returns an evaluated task' do
57
- expect(task).to be_a Task
58
- end
59
-
60
- it 'evaluates the task condition' do
61
- expect(task.condition).to be_a Condition
62
- end
63
-
64
- it 'evaluates the task actions' do
65
- expect(task.actions).to match [
66
- an_instance_of(SomeAction)
67
- ]
68
- end
69
-
70
- context 'when task arguments are given' do
71
- let(:code) { proc { |a, b| throw a } }
72
- let(:arguments) { %i[foo bar] }
73
-
74
- it 'passes arguments as block parameters during evaluation' do
75
- expect { task }.to throw_symbol :foo
76
- end
77
- end
78
- end
79
-
80
- describe '#initialize' do
81
- subject(:task) { described_class.new(env, name) }
82
-
83
- it 'assigns no action' do
84
- expect(task.actions).to be_empty
85
- end
86
-
87
- it 'assigns a truthy condition' do
88
- expect(task.condition).to be_truthy
89
- end
90
- end
91
-
92
- describe '#to_s' do
93
- it 'includes the task name' do
94
- expect(task.to_s).to include name.to_s
95
- end
96
- end
97
-
98
- describe '#condition_met?' do
99
- context 'when condition is truthy' do
100
- let(:condition) { true }
101
-
102
- it 'returns true' do
103
- expect(task.condition_met?).to be true
104
- end
105
- end
106
-
107
- context 'when condition is falsy' do
108
- let(:condition) { false }
109
-
110
- it 'returns false' do
111
- expect(task.condition_met?).to be false
112
- end
113
- end
114
- end
115
-
116
- describe '#condition' do
117
- it 'returns current condition' do
118
- expect(task.condition).to eq :some_condition
119
- end
120
-
121
- context 'when a block is given' do
122
- it 'assigns a new evaluated condition' do
123
- task.condition { :some_new_condition }
124
- expect(task.condition.return_value).to eq :some_new_condition
125
- end
126
- end
127
- end
128
-
129
- describe '#task' do
130
- before { described_class.define_action(:some_action, SomeAction) }
131
-
132
- it 'registers a nested task as an action' do
133
- task.task(:nested_task) { some_action }
134
- expect(task.actions).to match [an_instance_of(Task)]
135
- end
136
- end
137
-
138
- describe '#ask' do
139
- let(:question) { 'Which letter?' }
140
- let(:choices) { [[:a, ?A], [:b, ?B]] }
141
- let(:prompter) { instance_spy Prompter }
142
- subject(:ask) { task.ask question, choices, prompter: prompter }
143
-
144
- it 'prompts for choices' do
145
- ask
146
- expect(prompter).to have_received(:prompt).with(question, choices)
147
- end
148
-
149
- it 'returns selected choice' do
150
- allow(prompter).to receive(:prompt) { :choice }
151
- expect(ask).to eq :choice
152
- end
153
- end
154
-
155
- describe '#set' do
156
- it 'sets a value in the registry' do
157
- task.set :some_key, :some_value
158
- expect(task.get :some_key).to eq :some_value
159
- end
160
- end
161
-
162
- describe '#get' do
163
- before { env[:some_key] = :some_value }
164
-
165
- it 'fetches a value from the registry at given index' do
166
- expect(task.get :some_key).to eq :some_value
167
- end
168
- end
169
-
170
- describe '#set?' do
171
- before { env[:some_key] = :some_value }
172
-
173
- it 'returns true when given key exists' do
174
- expect(task.set? :some_key).to be true
175
- end
176
-
177
- it 'returns false when given key does not exist' do
178
- expect(task.set? :other_key).to be false
179
- end
180
- end
181
-
182
- describe '#target' do
183
- before { env.target = :some_target }
184
-
185
- it 'returns current env target' do
186
- expect(task.target).to eq :some_target
187
- end
188
- end
189
-
190
- describe '#recipe_argv' do
191
- before { env.recipe_argv = %w[foo bar] }
192
-
193
- it 'returns recipe arguments' do
194
- expect(task.recipe_argv).to eq %w[foo bar]
195
- end
196
- end
197
- end
198
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- describe Template do
5
- include FixturesHelpers
6
-
7
- let(:path) { 'basic' }
8
- let(:search_path) { fixture_path_for 'templates' }
9
- subject(:template) { described_class.new path, search_path: search_path }
10
-
11
- describe '#render' do
12
- it 'renders ERB templates' do
13
- expect(template.render).to eq "basic template\n"
14
- end
15
-
16
- context 'yaml templates' do
17
- let(:path) { 'basic_yaml' }
18
-
19
- it 'renders yaml templates' do
20
- expect(template.render).to eq({ 'foo' => 'bar' })
21
- end
22
- end
23
-
24
- context 'when variables are given' do
25
- let(:path) { 'variables' }
26
-
27
- it 'declares given variables in ERB render binding' do
28
- expect(template.render foo: 'bar').to eq "bar\n"
29
- end
30
- end
31
-
32
- context 'when relative path is requested' do
33
- let(:path) { fixture_path_for('templates/basic').insert 0, './' }
34
-
35
- it 'does not enforce `template\' search path' do
36
- expect(template.render).to eq "basic template\n"
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- describe Test do
5
- it_behaves_like 'test'
6
- end
7
- end
@@ -1,66 +0,0 @@
1
- require 'spec_helper'
2
- require 'producer/core/testing'
3
-
4
- module Producer::Core
5
- module Testing
6
- describe MockRemote do
7
- subject(:remote) { described_class.new('some_host.example') }
8
-
9
- it 'is a remote' do
10
- expect(remote).to be_a Remote
11
- end
12
-
13
- describe '#session' do
14
- it 'raises an error to prevent real session usage' do
15
- expect { remote.session }.to raise_error RuntimeError
16
- end
17
- end
18
-
19
- describe '#execute' do
20
- context 'dummy echo command' do
21
- let(:command) { 'echo some arguments' }
22
-
23
- it 'returns command arguments ended by a record separator' do
24
- expect(remote.execute command).to eq "some arguments\n"
25
- end
26
- end
27
-
28
- context 'dummy true command' do
29
- let(:command) { 'true' }
30
-
31
- it 'returns an empty string' do
32
- expect(remote.execute(command)).to eq ''
33
- end
34
- end
35
-
36
- context 'dummy false command' do
37
- let(:command) { 'false' }
38
-
39
- it 'raises a RemoteCommandExecutionError' do
40
- expect { remote.execute(command) }
41
- .to raise_error RemoteCommandExecutionError
42
- end
43
- end
44
-
45
- context 'dummy type command' do
46
- context 'executable exists' do
47
- let(:command) { 'type true' }
48
-
49
- it 'returns an empty string' do
50
- expect(remote.execute(command)).to eq ''
51
- end
52
- end
53
-
54
- context 'executable does not exist' do
55
- let(:command) { 'type some_non_existent_executable' }
56
-
57
- it 'raises a RemoteCommandExecutionError' do
58
- expect { remote.execute(command) }
59
- .to raise_error RemoteCommandExecutionError
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe ConditionTest do
6
- let(:env) { double 'env' }
7
- let(:block) { proc { true } }
8
- let(:arguments) { [:some, :args] }
9
- subject(:test) { described_class.new(env, block, *arguments) }
10
-
11
- it_behaves_like 'test'
12
-
13
- describe '#verify' do
14
- context 'when condition is met' do
15
- it 'returns true' do
16
- expect(test.verify).to be true
17
- end
18
- end
19
-
20
- context 'when condition is not met' do
21
- let(:block) { proc { false } }
22
-
23
- it 'returns false' do
24
- expect(test.verify).to be false
25
- end
26
- end
27
- end
28
-
29
- describe '#condition' do
30
- it 'evaluates a conditon' do
31
- expect(Condition).to receive(:evaluate).with(env, *arguments, &block)
32
- test.condition
33
- end
34
-
35
- it 'returns the evaluated condition' do
36
- condition = double 'condition'
37
- allow(Condition).to receive(:evaluate) { condition }
38
- expect(test.condition).to eq condition
39
- end
40
- end
41
-
42
- describe '#condition_args' do
43
- it 'returns arguments for condition' do
44
- expect(test.condition_args).to eq arguments
45
- end
46
- end
47
-
48
- describe '#condition_block' do
49
- it 'returns condition block' do
50
- expect(test.condition_block).to eq block
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe FileContains, :env do
6
- let(:filepath) { 'some_file' }
7
- let(:content) { 'some_content' }
8
- subject(:test) { described_class.new(env, filepath, content) }
9
-
10
- it_behaves_like 'test'
11
-
12
- describe '#verify' do
13
- context 'when file contains the content' do
14
- before do
15
- allow(remote_fs)
16
- .to receive(:file_read).with(filepath) { "foo#{content}bar" }
17
- end
18
-
19
- it 'returns true' do
20
- expect(test.verify).to be true
21
- end
22
- end
23
-
24
- context 'when file does not contain the content' do
25
- before do
26
- allow(remote_fs).to receive(:file_read).with(filepath) { 'foo bar' }
27
- end
28
-
29
- it 'returns false' do
30
- expect(test.verify).to be false
31
- end
32
- end
33
-
34
- context 'when file does not exist' do
35
- before do
36
- allow(remote_fs).to receive(:file_read).with(filepath) { nil }
37
- end
38
-
39
- it 'returns false' do
40
- expect(test.verify).to be false
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe FileEq, :env do
6
- let(:filepath) { 'some_file' }
7
- let(:content) { 'some content' }
8
- subject(:test) { described_class.new(env, filepath, content) }
9
-
10
- it_behaves_like 'test'
11
-
12
- describe '#verify' do
13
- context 'when file content matches' do
14
- before do
15
- allow(remote_fs).to receive(:file_read).with(filepath) { content }
16
- end
17
-
18
- it 'returns true' do
19
- expect(test.verify).to be true
20
- end
21
- end
22
-
23
- context 'when file content does not match' do
24
- before do
25
- allow(remote_fs).to receive(:file_read).with(filepath) { 'foo bar' }
26
- end
27
-
28
- it 'returns false' do
29
- expect(test.verify).to be false
30
- end
31
- end
32
-
33
- context 'when file does not exist' do
34
- before do
35
- allow(remote_fs).to receive(:file_read).with(filepath) { nil }
36
- end
37
-
38
- it 'returns false' do
39
- expect(test.verify).to be false
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe FileMatch, :env do
6
- let(:filepath) { 'some_file' }
7
- let(:pattern) { /\Asome_content\z/ }
8
- subject(:test) { described_class.new(env, filepath, pattern) }
9
-
10
- it_behaves_like 'test'
11
-
12
- describe '#verify' do
13
- context 'when file matches the pattern' do
14
- before do
15
- allow(remote_fs)
16
- .to receive(:file_read).with(filepath) { 'some_content' }
17
- end
18
-
19
- it 'returns true' do
20
- expect(test.verify).to be true
21
- end
22
- end
23
-
24
- context 'when file does not match the pattern' do
25
- before do
26
- allow(remote_fs).to receive(:file_read).with(filepath) { 'foo bar' }
27
- end
28
-
29
- it 'returns false' do
30
- expect(test.verify).to be false
31
- end
32
- end
33
-
34
- context 'when file does not exist' do
35
- before do
36
- allow(remote_fs).to receive(:file_read).with(filepath) { nil }
37
- end
38
-
39
- it 'returns false' do
40
- expect(test.verify).to be false
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe HasDir, :env do
6
- let(:path) { 'some_directory' }
7
- subject(:has_dir) { described_class.new(env, path) }
8
-
9
- it_behaves_like 'test'
10
-
11
- describe '#verify' do
12
- it 'delegates the call on remote FS' do
13
- expect(remote_fs).to receive(:dir?).with(path)
14
- has_dir.verify
15
- end
16
-
17
- it 'returns the dir existence' do
18
- existence = double 'existence'
19
- allow(remote_fs).to receive(:dir?) { existence }
20
- expect(has_dir.verify).to be existence
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,75 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe HasEnv do
6
- let(:env) { Env.new }
7
- let(:var_name) { 'SOME_VAR' }
8
- let(:var_value) { 'SOME_VALUE' }
9
- let(:remote_env) { { 'SOME_VAR' => 'SOME_VALUE' } }
10
- subject(:has_env) { described_class.new(env, var_name) }
11
-
12
- it_behaves_like 'test'
13
-
14
- before do
15
- allow(env.remote).to receive(:environment) { remote_env }
16
- end
17
-
18
- context 'when only var name is provided' do
19
- describe '#verify' do
20
- context 'when remote environment var is defined' do
21
- it 'returns true' do
22
- expect(has_env.verify).to be true
23
- end
24
-
25
- context 'when var name is given as a lowercase symbol' do
26
- let(:var_name) { :some_var }
27
-
28
- it 'returns true' do
29
- expect(has_env.verify).to be true
30
- end
31
- end
32
- end
33
-
34
- context 'when remote environment var is not defined' do
35
- let(:var_name) { 'SOME_NON_EXISTENT_VAR' }
36
-
37
- it 'returns false' do
38
- expect(has_env.verify).to be false
39
- end
40
- end
41
- end
42
- end
43
-
44
- context 'when var name and value are provided' do
45
- subject(:has_env) { described_class.new(env, var_name, var_value) }
46
-
47
- describe '#verify' do
48
- context 'when remote environment var is defined' do
49
- context 'when value is the same' do
50
- it 'returns true' do
51
- expect(has_env.verify).to be true
52
- end
53
- end
54
-
55
- context 'when value differs' do
56
- let(:remote_env) { { 'SOME_VAR' => 'SOME_OTHER_VALUE' } }
57
-
58
- it 'return false' do
59
- expect(has_env.verify).to be false
60
- end
61
- end
62
- end
63
-
64
- context 'when remote environment var is not defined' do
65
- let(:var_name) { 'SOME_NON_EXISTENT_VAR' }
66
-
67
- it 'return false' do
68
- expect(has_env.verify).to be false
69
- end
70
- end
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe HasExecutable, :env do
6
- subject(:test) { described_class.new(env, executable) }
7
-
8
- it_behaves_like 'test'
9
-
10
- describe '#verify' do
11
- context 'executable exists' do
12
- let(:executable) { 'true' }
13
-
14
- it 'returns true' do
15
- expect(test.verify).to be true
16
- end
17
- end
18
-
19
- context 'executable does not exist' do
20
- let(:executable) { 'some_non_existent_executable' }
21
-
22
- it 'returns false' do
23
- expect(test.verify).to be false
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe HasFile, :env do
6
- let(:filepath) { 'some_file' }
7
- subject(:has_file) { described_class.new(env, filepath) }
8
-
9
- it_behaves_like 'test'
10
-
11
- describe '#verify' do
12
- it 'delegates the call on remote FS' do
13
- expect(remote_fs).to receive(:file?).with(filepath)
14
- has_file.verify
15
- end
16
-
17
- it 'returns the file existence' do
18
- existence = double 'existence'
19
- allow(remote_fs).to receive(:file?) { existence }
20
- expect(has_file.verify).to be existence
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Producer::Core
4
- module Tests
5
- describe ShellCommandStatus, :env do
6
- let(:command) { 'true' }
7
- subject(:test) { described_class.new(env, command) }
8
-
9
- it_behaves_like 'test'
10
-
11
- describe '#verify' do
12
- context 'command return status is 0' do
13
- it 'returns true' do
14
- expect(test.verify).to be true
15
- end
16
- end
17
-
18
- context 'command return status is not 0' do
19
- let(:command) { 'false' }
20
-
21
- it 'returns false' do
22
- expect(test.verify).to be false
23
- end
24
- end
25
- end
26
-
27
- describe '#command' do
28
- it 'returns the first argument' do
29
- expect(test.command).to eq command
30
- end
31
- end
32
- end
33
- end
34
- end