Skip to content

Commit

Permalink
Change naming
Browse files Browse the repository at this point in the history
  • Loading branch information
josepjaume committed Oct 14, 2011
1 parent d407be0 commit ea76d35
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/spinach/hookable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module ClassMethods
#
# @example
# class
def define_hook(hook)
def hook(hook)
define_method hook do |&block|
add_hook(hook, &block)
end
Expand Down
28 changes: 14 additions & 14 deletions lib/spinach/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,31 @@ class Hooks
# Spinach.before_run do
# # Whatever
# end
define_hook :before_run
hook :before_run

# Runs after the entire spinach run
#
# @example
# Spinach.after_run do |status|
# # status is true when the run is successful, false otherwise
# end
define_hook :after_run
hook :after_run

# Runs before every feature,
#
# @example
# Spinach.before_feature do |feature_data|
# # feature_data is a hash of the parsed feature data
# end
define_hook :before_feature
hook :before_feature

# Runs after every feature
#
# @example
# Spinach.after_feature do |feature_data|
# # feature_data is a hash of the parsed feature data
# end
define_hook :after_feature
hook :after_feature

# Runs when an undefined feature is found
#
Expand All @@ -61,39 +61,39 @@ class Hooks
# # feature_data is a hash of the parsed feature data
# # exception contains the thrown exception
# end
define_hook :on_undefined_feature
hook :on_undefined_feature

# Runs before every scenario
#
# @example
# Spinach.before_scenario do |scenario_data|
# # feature_data is a hash of the parsed scenario data
# end
define_hook :before_scenario
hook :before_scenario

# Runs after every scenario
#
# @example
# Spinach.after_scenario do |scenario_data|
# # feature_data is a hash of the parsed scenario data
# end
define_hook :after_scenario
hook :after_scenario

# Runs before every step execution
#
# @example
# Spinach.before_step do |step_data|
# # step_data contains a hash with this step's data
# end
define_hook :before_step
hook :before_step

# Runs after every step execution
#
# @example
# Spinach.before_step do |step_data|
# # step_data contains a hash with this step's data
# end
define_hook :after_step
hook :after_step

# Runs after every successful step execution
#
Expand All @@ -103,7 +103,7 @@ class Hooks
# # step_location contains a string indication this step definition's
# # location
# end
define_hook :on_successful_step
hook :on_successful_step

# Runs after every failed step execution
#
Expand All @@ -113,7 +113,7 @@ class Hooks
# # step_location contains a string indication this step definition's
# # location
# end
define_hook :on_failed_step
hook :on_failed_step

# Runs after every step execution that raises an exception
#
Expand All @@ -123,7 +123,7 @@ class Hooks
# # step_location contains a string indication this step definition's
# # location
# end
define_hook :on_error_step
hook :on_error_step

# Runs every time a step which is not defined is called
#
Expand All @@ -133,7 +133,7 @@ class Hooks
# # step_location contains a string indication this step definition's
# # location
# end
define_hook :on_undefined_step
hook :on_undefined_step

# Runs every time a step is skipped because there has been an unsuccessful
# one just before.
Expand All @@ -142,7 +142,7 @@ class Hooks
# Spinach.on_undefined_step do |step_data|
# # step_data contains a hash with this step's data
# end
define_hook :on_skipped_step
hook :on_skipped_step

end

Expand Down
2 changes: 1 addition & 1 deletion test/spinach/hookable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

describe ".define_hook" do
it "defines a new hook" do
subject.class.define_hook :before_save
subject.class.hook :before_save
subject.must_respond_to :before_save
end
end
Expand Down

0 comments on commit ea76d35

Please sign in to comment.