From f290bcf169889294ddb4560b4aa1395fccef3f1a Mon Sep 17 00:00:00 2001 From: David McMullin Date: Sat, 17 Nov 2012 22:51:02 +0000 Subject: [PATCH] add tests so it doesn't break again --- features/aspect_navigation.feature | 11 +++++++++++ features/step_definitions/aspects_steps.rb | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/features/aspect_navigation.feature b/features/aspect_navigation.feature index 9611d7ba8..056eea243 100644 --- a/features/aspect_navigation.feature +++ b/features/aspect_navigation.feature @@ -7,11 +7,13 @@ Feature: Aspect navigation on the left menu Background: Given a user with username "bob" And I sign in as "bob@bob.bob" + And I have an aspect called "Others" Scenario: All aspects are selected by default When I go to the aspects page Then I should see "Besties" aspect selected Then I should see "Unicorns" aspect selected + Then I should see "Others" aspect selected Scenario: Aspects selection is remembered through site navigation When I go to the aspects page @@ -20,3 +22,12 @@ Feature: Aspect navigation on the left menu And I go to the aspects page Then I should see "Besties" aspect selected Then I should see "Unicorns" aspect unselected + Then I should see "Others" aspect unselected + + Scenario: Aspects selection can include one or more aspects + When I go to the aspects page + And I select only "Besties" aspect + And I select "Unicorns" aspect as well + Then I should see "Besties" aspect selected + Then I should see "Unicorns" aspect selected + Then I should see "Others" aspect unselected diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index 58770a555..b20f24edb 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -26,6 +26,14 @@ When /^I select only "([^"]*)" aspect$/ do |aspect_name| step %{I wait for the ajax to finish} end +When /^I select "([^"]*)" aspect as well$/ do |aspect_name| + within('#aspect_nav') do + click_link aspect_name + end + + step %{I wait for the ajax to finish} +end + When /^I should see "([^"]*)" aspect selected$/ do |aspect_name| aspect = @me.aspects.where(:name => aspect_name).first within("#aspect_nav") do