producer-core 0.1.1 → 0.1.2

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.
@@ -7,6 +7,5 @@ Feature: `echo' task action
7
7
  echo 'hello'
8
8
  end
9
9
  """
10
- When I execute the recipe
11
- Then the exit status must be 0
12
- And the output must contain exactly "hello\n"
10
+ When I successfully execute the recipe
11
+ Then the output must contain exactly "hello\n"
@@ -1,5 +1,5 @@
1
1
  @sshd
2
- Feature: sh task action
2
+ Feature: `sh' task action
3
3
 
4
4
  Scenario: executes command
5
5
  Given a recipe with:
@@ -22,7 +22,7 @@ Feature: sh task action
22
22
  sh '\echo from remote'
23
23
  end
24
24
  """
25
- When I execute the recipe
25
+ When I successfully execute the recipe
26
26
  Then the output must contain "from remote"
27
27
 
28
28
  Scenario: aborts on failed command execution
@@ -5,6 +5,5 @@ Feature: recipe evaluation
5
5
  """
6
6
  puts 'hello from recipe'
7
7
  """
8
- When I execute the recipe
9
- Then the exit status must be 0
10
- And the output must contain exactly "hello from recipe\n"
8
+ When I successfully execute the recipe
9
+ Then the output must contain exactly "hello from recipe\n"
@@ -11,6 +11,5 @@ Feature: `source' recipe keyword
11
11
  """
12
12
  puts 'sourced recipe'
13
13
  """
14
- When I execute the recipe
15
- Then the exit status must be 0
16
- And the output must contain "sourced recipe"
14
+ When I successfully execute the recipe
15
+ Then the output must contain "sourced recipe"
@@ -7,6 +7,5 @@ Feature: `target' recipe keyword
7
7
 
8
8
  puts env.target
9
9
  """
10
- When I execute the recipe
11
- Then the exit status must be 0
12
- And the output must contain exactly "some_host.example\n"
10
+ When I successfully execute the recipe
11
+ Then the output must contain exactly "some_host.example\n"
@@ -5,3 +5,8 @@ end
5
5
  When(/^I execute the recipe$/) do
6
6
  run_simple('producer recipe.rb', false)
7
7
  end
8
+
9
+ When(/^I successfully execute the recipe$/) do
10
+ step 'I execute the recipe'
11
+ assert_exit_status(0)
12
+ end
@@ -9,6 +9,5 @@ Feature: `condition' task keyword
9
9
  echo 'evaluated'
10
10
  end
11
11
  """
12
- When I execute the recipe
13
- Then the exit status must be 0
14
- And the output must not contain "evaluated"
12
+ When I successfully execute the recipe
13
+ Then the output must not contain "evaluated"
@@ -7,6 +7,5 @@ Feature: task evaluation
7
7
  puts 'hello from recipe'
8
8
  end
9
9
  """
10
- When I execute the recipe
11
- Then the exit status must be 0
12
- And the output must contain exactly "hello from recipe\n"
10
+ When I successfully execute the recipe
11
+ Then the output must contain exactly "hello from recipe\n"
@@ -12,9 +12,8 @@ Feature: `has_env' condition keyword
12
12
  echo 'evaluated'
13
13
  end
14
14
  """
15
- When I execute the recipe
16
- Then the exit status must be 0
17
- And the output must contain "evaluated"
15
+ When I successfully execute the recipe
16
+ Then the output must contain "evaluated"
18
17
 
19
18
  Scenario: fails when remote environment variable is not defined
20
19
  Given a recipe with:
@@ -27,6 +26,5 @@ Feature: `has_env' condition keyword
27
26
  echo 'evaluated'
28
27
  end
29
28
  """
30
- When I execute the recipe
31
- Then the exit status must be 0
32
- And the output must not contain "evaluated"
29
+ When I successfully execute the recipe
30
+ Then the output must not contain "evaluated"
@@ -1,6 +1,6 @@
1
1
  module Producer
2
2
  module Core
3
- class Tests
3
+ module Tests
4
4
  class HasEnv < Test
5
5
  def success?
6
6
  env.remote.environment.has_key? arguments.first.to_s.upcase
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module Core
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -18,4 +18,3 @@ module Producer::Core
18
18
  end
19
19
  end
20
20
  end
21
-
@@ -13,11 +13,7 @@ module Producer::Core
13
13
 
14
14
  describe '#process_task' do
15
15
  let(:action) { double('action') }
16
- let(:task) { double('task').as_null_object }
17
-
18
- before do
19
- allow(task).to receive(:actions) { [action] }
20
- end
16
+ let(:task) { double('task', actions: [action]).as_null_object }
21
17
 
22
18
  context 'when task condition is met' do
23
19
  it 'applies the actions' do
@@ -6,13 +6,13 @@ module Producer::Core
6
6
 
7
7
  let(:code) { proc { } }
8
8
  let(:env) { double('env').as_null_object }
9
- subject(:dsl) { Recipe::DSL.new &code }
9
+ subject(:dsl) { Recipe::DSL.new(&code) }
10
10
 
11
11
  describe '.evaluate' do
12
12
  let(:code) { 'nil' }
13
13
 
14
14
  it 'builds a new DSL sandbox with given code' do
15
- expect(Recipe::DSL).to receive(:new).once.with(code).and_call_original
15
+ expect(Recipe::DSL).to receive(:new).with(code).and_call_original
16
16
  Recipe::DSL.evaluate(code, env)
17
17
  end
18
18
 
@@ -93,7 +93,7 @@ module Producer::Core
93
93
  describe '#source' do
94
94
  let(:filepath) { fixture_path_for 'recipes/throw' }
95
95
  let(:code) { "source '#{filepath}'" }
96
- subject(:dsl) { Recipe::DSL.new code }
96
+ subject(:dsl) { Recipe::DSL.new(code) }
97
97
 
98
98
  it 'sources the recipe given as argument' do
99
99
  expect { dsl.evaluate(env) }.to throw_symbol :recipe_code
@@ -4,7 +4,7 @@ module Producer::Core
4
4
  describe Task::DSL do
5
5
  let(:block) { proc { } }
6
6
  let(:env) { double('env') }
7
- subject(:dsl) { Task::DSL.new &block }
7
+ subject(:dsl) { Task::DSL.new(&block) }
8
8
 
9
9
  %w[echo sh].each do |action|
10
10
  it "has `#{action}' action defined" do
@@ -16,7 +16,7 @@ module Producer::Core
16
16
  let(:name) { :some_task }
17
17
 
18
18
  it 'builds a new DSL sandbox with given code' do
19
- expect(Task::DSL).to receive(:new).once.with(&block).and_call_original
19
+ expect(Task::DSL).to receive(:new).with(&block).and_call_original
20
20
  Task::DSL.evaluate(name, env, &block)
21
21
  end
22
22
 
@@ -28,10 +28,10 @@ module Producer::Core
28
28
  end
29
29
 
30
30
  it 'builds a task with its name, actions and condition' do
31
- dsl = double('dsl').as_null_object
31
+ dsl = double(
32
+ 'dsl', actions: [:some_action], condition: :some_condition
33
+ ).as_null_object
32
34
  allow(Task::DSL).to receive(:new) { dsl }
33
- allow(dsl).to receive(:actions) { [:some_action] }
34
- allow(dsl).to receive(:condition) { :some_condition }
35
35
  expect(Task)
36
36
  .to receive(:new).with(:some_task, [:some_action], :some_condition)
37
37
  Task::DSL.evaluate(name, env, &block)
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,6 @@ RSpec.configure do |c|
11
11
 
12
12
  c.include NetSSHStoryHelpers, :ssh
13
13
  c.before(:each, :ssh) do
14
- allow(remote).to receive(:session) { connection }
14
+ allow(Net::SSH).to receive(:start) { connection }
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producer-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-20 00:00:00.000000000 Z
12
+ date: 2013-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -114,7 +114,6 @@ files:
114
114
  - features/recipes/source.feature
115
115
  - features/recipes/target.feature
116
116
  - features/steps/recipe_steps.rb
117
- - features/support/env.rb
118
117
  - features/support/env_aruba.rb
119
118
  - features/support/env_cucumber-doc_string.rb
120
119
  - features/support/ssh.rb
@@ -187,7 +186,7 @@ rubyforge_project:
187
186
  rubygems_version: 1.8.23
188
187
  signing_key:
189
188
  specification_version: 3
190
- summary: producer-core-0.1.1
189
+ summary: producer-core-0.1.2
191
190
  test_files:
192
191
  - features/actions/echo.feature
193
192
  - features/actions/sh.feature
@@ -197,7 +196,6 @@ test_files:
197
196
  - features/recipes/source.feature
198
197
  - features/recipes/target.feature
199
198
  - features/steps/recipe_steps.rb
200
- - features/support/env.rb
201
199
  - features/support/env_aruba.rb
202
200
  - features/support/env_cucumber-doc_string.rb
203
201
  - features/support/ssh.rb
File without changes