I was almost done with the recipe RSS feed last night, but had to stop when I realized that the first "Given" step was insufficient for the last "Then" step in the Cucumber scenario:
Feature: RSSSpecifically, the "20 delicious, easy to prepare recipes" did not include the summaries that would need to be verified by "Then I should see the summary of each recipe". I considered creating a new step rather than re-using this step (from the recipe search feature). After reviewing the step, it seemed unlikely that adding a summary to each recipe would have any adverse effects on existing scenarios. The reworked scenario becomes:
So that I tell my user when there are updates to this great cooking site
As an RSS bot
I want to be able to consume your RSS
Scenario: Recipe RSS
Given 20 delicious, easy to prepare recipes
When I access the recipe RSS feed
Then I should see the 10 most recent recipes
And I should see the summary of each recipe
Given /^(\d+) (.+) recipes$/ do |count, keyword|I can now check for the "recipe summary" in the RSS feed's
date = Date.new(2009, 4, 22)
(1..count.to_i).each do |i|
permalink = "id-#{i}-#{keyword.gsub(/\W/, '-')}"
recipe = {
:title => "#{keyword} recipe #{i}",
:summary => "recipe summary",
:date => date,
:preparations => [
{ 'ingredient' => { 'name' => 'ingredient' } }
],
:tag_names => [keyword.downcase]
}
RestClient.put "#{@@db}/#{permalink}",
recipe.to_json,
:content_type => 'application/json'
end
end
<description>
tag:Then /^I should see the summary of each recipe$/ doAnd, with that, I am done with the recipe RSS feed scenario:
response.
should have_selector("channel > item > description",
:content => "recipe summary")
end
cstrom@jaynestown:~/repos/eee-code$ cucumber features -n \To be certain that I have not broken anything, I re-run all tests and Cucumber scenarios. Happily nothing is broken and I have :
> -s "Recipe RSS"
Sinatra::Test is deprecated; use Rack::Test instead.
Feature: RSS
So that I tell my user when there are updates to this great cooking site
As an RSS bot
I want to be able to consume your RSS
Scenario: Recipe RSS
Given 20 delicious, easy to prepare recipes
When I access the recipe RSS feed
Then I should see the 10 most recent recipes
And I should see the summary of each recipe
1 scenario
4 passed steps
27 scenariosOnly one scenario is undefined at this point. That unfinished scenario, navigation between recipes, is not all that important so I could easily deploy without it done. I do need to make sure that lookup values (tools, people, books, etc) are handled properly and I need some CSS. I will head down that rabbit hole tomorrow.
9 skipped steps
1 undefined step
226 passed steps
No comments:
Post a Comment