Skip to content

Commit 9a2ec02

Browse files
committed
Added scenario around the preference for ruby hooks
1 parent a0da7b4 commit 9a2ec02

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

features/hook/running-a-deploy-hook.feature

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,28 @@ Feature: Running A Deploy Hook
8888
| before_restart |
8989
| after_restart |
9090
| after_deploy |
91-
#Scenario Outline: Running a callback with an Executable deploy hook
92-
#Given the george app has a <Callback Name> executable hook
93-
#When I run `engineyard-serverside hook <Callback Name>`
9491

95-
#Scenario: Running a callback with both Ruby and Executable deploy hooks
92+
Scenario Outline: Running a callback with both Ruby and Executable deploy hooks
93+
Given my app has a <Callback Name> executable deploy hook
94+
Given my app has a <Callback Name> ruby deploy hook
95+
When I run the <Callback Name> callback
96+
Then the <Callback Name> ruby deploy hook is executed
97+
But the <Callback Name> executable deploy hook is not executed
9698

99+
Examples:
100+
| Callback Name |
101+
| before_deploy |
102+
| before_bundle |
103+
| after_bundle |
104+
| before_compile_assets |
105+
| after_compile_assets |
106+
| before_migrate |
107+
| after_migrate |
108+
| before_symlink |
109+
| after_symlink |
110+
| before_restart |
111+
| after_restart |
112+
| after_deploy |
97113
#Scenario: Running a callback with a Ruby service hook
98114

99115
#Scenario: Running a callback with an Executable service hook

features/hook/step_definitions/running-a-deploy-hook-steps.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,11 @@ def framework_env
7777
end
7878

7979
Then %r{^the (.+) executable deploy hook is executed$} do |callback_name|
80-
found = ExecutedCommands.
81-
executed.
82-
select {|x|
83-
x.match(/engineyard-serverside-execute-hook #{callback_name}/)
84-
}.length > 0
80+
expect(ExecutedCommands.deploy_hook_executed?(callback_name)).to eql(true)
81+
end
8582

86-
expect(found).to eql(true)
83+
Then %r{^the (.+) executable deploy hook is not executed$} do |callback_name|
84+
expect(ExecutedCommands.deploy_hook_executed?(callback_name)).to eql(false)
8785
end
8886

8987
Then %{I see the output} do

features/support/runner.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ def self.reset
1616
@executed = nil
1717
end
1818

19-
def self.hook_executed?(path)
20-
executed.select {|x| x.match(/#{Regexp.escape(path)}/)}.length > 0
19+
def self.deploy_hook_executed?(callback_name)
20+
executed.
21+
select {|x|
22+
x.match(%r{engineyard-serverside-execute-hook #{callback_name}})
23+
}.length > 0
2124
end
25+
2226
end
2327

2428
module Runner

0 commit comments

Comments
 (0)