finish the feature description for notes. Some scenarios need js handling to implement. They are marked with the tag needsjs

exclude them with cucumber -t ~needsjs
This commit is contained in:
Reinier Balt 2009-05-25 21:20:50 +02:00
parent 149d05e04f
commit 8002eef8ab
2 changed files with 17 additions and 42 deletions

View file

@ -16,7 +16,6 @@ Feature: View, add, remove notes
Then 2 notes should be visible Then 2 notes should be visible
And the badge should show 2 And the badge should show 2
@focus
Scenario: Add a new note Scenario: Add a new note
Given I have logged in as "testuser" with password "secret" Given I have logged in as "testuser" with password "secret"
And I have one project "Pass Final Exam" with no notes And I have one project "Pass Final Exam" with no notes
@ -25,6 +24,7 @@ Feature: View, add, remove notes
And I should see note "My Note A" on the notes page And I should see note "My Note A" on the notes page
Then the badge should show 1 Then the badge should show 1
@needsjs
Scenario: Delete note from notes page Scenario: Delete note from notes page
Given I have logged in as "testuser" with password "secret" Given I have logged in as "testuser" with password "secret"
And I have a project "Pass Final Exam" with 2 notes And I have a project "Pass Final Exam" with 2 notes
@ -33,16 +33,18 @@ Feature: View, add, remove notes
Then the first note should disappear Then the first note should disappear
Then the badge should show 1 Then the badge should show 1
@needsjs
Scenario: Link to note Scenario: Link to note
Given I have logged in as "testuser" with password "secret" Given I have logged in as "testuser" with password "secret"
And I have one project "Pass Final Exam" with 1 note And I have a project "Pass Final Exam" with 1 note
When I visit the "Pass Final Exam" project page When I visit the "Pass Final Exam" project
And I click the icon next to the note And I click the icon next to the note
Then I should see the note text Then I should see the note text
@needsjs
Scenario: Toggle notes Scenario: Toggle notes
Given I have logged in as "testuser" with password "secret" Given I have logged in as "testuser" with password "secret"
And I have two projects with one note each And I have two projects with one note each
When I go to the notes page When I go to the notes page
And I click Toggle Notes And I click Toggle Notes
Then the body of the notes should be shown Then I should see the body of the notes

View file

@ -12,14 +12,6 @@ Then /^(.*) notes should be visible$/ do |number|
count.should == number.to_i count.should == number.to_i
end end
Then "the badge should show (.*)" do |number|
badge = -1
response.should have_xpath("//span[@id='badge_count']") do |node|
badge = node.first.content.to_i
end
badge.should == number.to_i
end
When /^I click Toggle Notes$/ do When /^I click Toggle Notes$/ do
click_link 'Toggle notes' click_link 'Toggle notes'
end end
@ -44,11 +36,15 @@ Then /^I should see note "([^\"]*)" on the notes page$/ do |note|
Then "I should see \"#{note}\"" Then "I should see \"#{note}\""
end end
Given /^I have a project "([^\"]*)" with 2 notes$/ do |arg1| Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
pending project = @current_user.projects.create!(:name => project_name)
num.to_i.downto 0 do |i|
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}")
end
end end
When /^I delete the first note$/ do When /^I delete the first note$/ do
# need selenium for this to check on the js
pending pending
end end
@ -56,37 +52,22 @@ Given /^I have one project "([^\"]*)" with 1 note$/ do |arg1|
pending pending
end end
When /^I visit the "([^\"]*)" project page$/ do |arg1|
pending
end
When /^I click the icon next to the note$/ do When /^I click the icon next to the note$/ do
# need selenium for this to check on the js
pending pending
end end
Then /^I should see the note text$/ do Then /^I should see the note text$/ do
# need selenium for this to check on the js
pending pending
end end
#------ Then /^I should see the body of the notes$/ do
pending
Given "Luis has one project Pass Final Exam with no notes" do
@exam_project = @luis.projects.create!(:name => 'Pass Final Exam')
end end
Given "Luis has one project Pass Final Exam with 1 note" do
Given "Luis has one project Pass Final Exam with no notes"
@exam_project.notes.create!(:user_id => @luis.id, :body => 'exam note 1')
end
Given "Luis has one project Pass Final Exam with 2 notes" do #------ left over from old stories. can be removed if pending stuff is done
Given "Luis has one project Pass Final Exam with 1 note"
@exam_project.notes.create!(:user_id => @luis.id, :body => 'exam note 2')
end
When "Luis visits the notes page" do
visits '/notes'
end
When "Luis adds a note from the Pass Final Exam project page" do When "Luis adds a note from the Pass Final Exam project page" do
When "Luis visits the Pass Final Exam project page" When "Luis visits the Pass Final Exam project page"
@ -95,10 +76,6 @@ fills_in 'new_note_body', :with => 'new exam note'
clicks_button 'Add note', :wait => :ajax clicks_button 'Add note', :wait => :ajax
end end
When "Luis visits the Pass Final Exam project page" do
visits "/projects/#{@exam_project.to_param}"
end
When "Luis deletes the first note" do When "Luis deletes the first note" do
selenium.click "css=a.delete_note" selenium.click "css=a.delete_note"
selenium.get_confirmation.should =~ /delete/ selenium.get_confirmation.should =~ /delete/
@ -113,10 +90,6 @@ When "Luis clicks Toggle Notes" do
clicks_link 'Toggle notes', :wait => :effects clicks_link 'Toggle notes', :wait => :effects
end end
Then "the body of the notes should be shown" do
pending
end
Then "Luis should see the note on the Pass Final Exam project page" do Then "Luis should see the note on the Pass Final Exam project page" do
should_see "new exam note" should_see "new exam note"
end end