add tests so it doesn't break again

This commit is contained in:
David McMullin 2012-11-17 22:51:02 +00:00
parent f6b32fd13a
commit f290bcf169
2 changed files with 19 additions and 0 deletions

View file

@ -7,11 +7,13 @@ Feature: Aspect navigation on the left menu
Background: Background:
Given a user with username "bob" Given a user with username "bob"
And I sign in as "bob@bob.bob" And I sign in as "bob@bob.bob"
And I have an aspect called "Others"
Scenario: All aspects are selected by default Scenario: All aspects are selected by default
When I go to the aspects page When I go to the aspects page
Then I should see "Besties" aspect selected Then I should see "Besties" aspect selected
Then I should see "Unicorns" aspect selected Then I should see "Unicorns" aspect selected
Then I should see "Others" aspect selected
Scenario: Aspects selection is remembered through site navigation Scenario: Aspects selection is remembered through site navigation
When I go to the aspects page 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 And I go to the aspects page
Then I should see "Besties" aspect selected Then I should see "Besties" aspect selected
Then I should see "Unicorns" aspect unselected 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

View file

@ -26,6 +26,14 @@ When /^I select only "([^"]*)" aspect$/ do |aspect_name|
step %{I wait for the ajax to finish} step %{I wait for the ajax to finish}
end 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| When /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first aspect = @me.aspects.where(:name => aspect_name).first
within("#aspect_nav") do within("#aspect_nav") do