Send to Kindle

Tuesday, September 15, 2009

Last Feature Complete

‹prev | My Chain | next›

Time to verify my very last feature.

I add the alternative_preparation helper to my view:
...
%div
= alternative_preparations(@recipe['_id'])


- if @recipe['preparations']
%ul.preparations
...
Dammit. I don't know why I called it "alternative" preparations. So I rename alternative_preparations to alternate_preparations:
...
%div
= alternate_preparations(@recipe['_id'])

- if @recipe['preparations']
%ul.preparations
...
Ah, better.

When last I was working in the Cucumber layer, my alternate links were missing:
cstrom@jaynestown:~/repos/eee-code$ cucumber   features/recipe_alternate_preparations.feature:14
Sinatra::Test is deprecated; use Rack::Test instead.
Feature: Alternate preparations for recipes

As a user curious about a recipe
I want to see a list of similar recipes
So that I can find a recipe that matches my tastes or ingredients on hand

Scenario: Alternate preparation
Given a "Hearty Pancake" recipe with "wheat germ"
And a "Buttermilk Pancake" recipe with "buttermilk"
And a "Pancake" recipe with "chocolate chips"
When the three pancake recipes are alternate preparations of each other
And I visit the "Hearty Pancake" recipe
Then I should see a link to the "Buttermilk Pancake" recipe
expected following output to contain a <a>Buttermilk Pancake</a> tag:

...
And I should see a link to the "Pancake" recipe
And I should not see a link to the "Hearty Pancake" recipe
When I click the "Buttermilk Pancake" link
Then I should see a link to the "Hearty Pancake" recipe
And I should see a link to the "Pancake" recipe
And I should not see a link to the "Buttermilk Pancake" recipe

Failing Scenarios:
cucumber features/recipe_alternate_preparations.feature:14 # Scenario: Alternate preparation

1 scenario (1 failed)
12 steps (1 failed, 6 skipped, 5 passed)
0m0.675s
All of the steps were defined, including building the alternates document, but there was no code to present the links to alternate preparations. Now that I have done all of my inside work, hopefully that step will pass:
cstrom@jaynestown:~/repos/eee-code$ cucumber -s \
features/recipe_alternate_preparations.feature:14
Sinatra::Test is deprecated; use Rack::Test instead.
Feature: Alternate preparations for recipes

As a user curious about a recipe
I want to see a list of similar recipes
So that I can find a recipe that matches my tastes or ingredients on hand

Scenario: Alternate preparation
Given a "Hearty Pancake" recipe with "wheat germ"
And a "Buttermilk Pancake" recipe with "buttermilk"
And a "Pancake" recipe with "chocolate chips"
When the three pancake recipes are alternate preparations of each other
And I visit the "Hearty Pancake" recipe
Then I should see a link to the "Buttermilk Pancake" recipe
And I should see a link to the "Pancake" recipe
And I should not see a link to the "Hearty Pancake" recipe
When I click the "Buttermilk Pancake" link
Then I should see a link to the "Hearty Pancake" recipe
And I should see a link to the "Pancake" recipe
And I should not see a link to the "Buttermilk Pancake" recipe

1 scenario (1 passed)
12 steps (12 passed)
0m0.772s
Nice!

Before calling this feature done, I have a look at the feature in the browser:



That is pretty good, but I am partial to the way we do it on the legacy site:



The indentation make it more obvious that the links belong to the header. Making the "Alternative Preparations" text bold catches the eye a bit more. The CSS that does the trick:
#recipe-alternates {
margin:0 8px;
padding-left:10px;
text-indent:-10px;
}

.label {
font-weight: bold;
}
With that, I am done with my last feature!

(commit)

Where do I go from here? Well first up, deployment. Then, maybe some finishing touches here and there. Starting tomorrow.

No comments:

Post a Comment