From 8e05027a9ec5ff9f85b051d9cff0b8547ead5f16 Mon Sep 17 00:00:00 2001 From: eee-c Date: Sun, 29 Mar 2009 17:22:20 -0400 Subject: [PATCH] Make the ingredient brand parenthetical and optional. --- spec/views/recipe.haml_spec.rb | 13 +++++++++++++ views/recipe.haml | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/views/recipe.haml_spec.rb b/spec/views/recipe.haml_spec.rb index 7d0ab6e..656e053 100644 --- a/spec/views/recipe.haml_spec.rb +++ b/spec/views/recipe.haml_spec.rb @@ -43,6 +43,10 @@ should have_selector(".ingredient > .quantity", :content => '1') end end + + it "should not render a brand" do + response.should_not have_selector(".ingredient > .brand") + end end context "a recipe with 1 cup of all-purpose, unbleached flour" do @@ -106,5 +110,14 @@ :content => 'Nestle Tollhouse') end end + + it "should note the brand parenthetically after the name" do + response.should have_selector(".preparations") do |preparations| + preparations. + should have_selector(".ingredient > .name + .brand", + :content => '(Nestle Tollhouse)') + end + + end end end diff --git a/views/recipe.haml b/views/recipe.haml index 8504f11..71373a5 100644 --- a/views/recipe.haml +++ b/views/recipe.haml @@ -13,5 +13,6 @@ = preparation['ingredient']['kind'] %span.name = preparation['ingredient']['name'] - %span.brand - = preparation['brand'] + - if preparation['brand'] + %span.brand + = "(" + preparation['brand'] + ")"