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.
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.
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
Before, After, AfterStep, World etc. Ruby hooks are uppercase because the Given, When, Then Ruby hooks are uppercase.Given, When, Then Ruby hooks are uppercase because the Given, When, Then Gherkin keywords are uppercase.Given, When, Then Gherkin keywords are uppercase because the Gherkin language is intended to match the standard template for BDD User Stories.