tags:

views:

99

answers:

2

Hi,

Cucumber has a few different hook methods like Before, After or AfterStep.

I was wondering - why doesn't these method names follow Ruby's naming conventions to write method names all lowercase?

Thanks.

A: 

This is merely speculation on my part but I guess the hook methods' names are camel-cased to match Then, When, and Given methods which are used to define steps:

Then "I should be served coffee" do
  @machine.dispensed_drink.should == "coffee"
end

Step definition methods' names are in turn camel-cased to match the way scenarios look:

Scenario: Buy last coffee
  Given there are 1 coffees left in the machine
  And I have deposited 1$
  When I press the coffee button
  Then I should be served a coffee
mtyaka
+3  A: 
  1. The Before, After, AfterStep, World etc. Ruby hooks are uppercase because the Given, When, Then Ruby hooks are uppercase.
  2. The Given, When, Then Ruby hooks are uppercase because the Given, When, Then Gherkin keywords are uppercase.
  3. The Given, When, Then Gherkin keywords are uppercase because the Gherkin language is intended to match the standard template for BDD User Stories.
Jörg W Mittag