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
And the badge should show 2
@focus
Scenario: Add a new note
Given I have logged in as "testuser" with password "secret"
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
Then the badge should show 1
@needsjs
Scenario: Delete note from notes page
Given I have logged in as "testuser" with password "secret"
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 badge should show 1
@needsjs
Scenario: Link to note
Given I have logged in as "testuser" with password "secret"
And I have one project "Pass Final Exam" with 1 note
When I visit the "Pass Final Exam" project page
And I have a project "Pass Final Exam" with 1 note
When I visit the "Pass Final Exam" project
And I click the icon next to the note
Then I should see the note text
@needsjs
Scenario: Toggle notes
Given I have logged in as "testuser" with password "secret"
And I have two projects with one note each
When I go to the notes page
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
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
click_link 'Toggle notes'
end
@ -44,11 +36,15 @@ Then /^I should see note "([^\"]*)" on the notes page$/ do |note|
Then "I should see \"#{note}\""
end
Given /^I have a project "([^\"]*)" with 2 notes$/ do |arg1|
pending
Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
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
When /^I delete the first note$/ do
# need selenium for this to check on the js
pending
end
@ -56,37 +52,22 @@ Given /^I have one project "([^\"]*)" with 1 note$/ do |arg1|
pending
end
When /^I visit the "([^\"]*)" project page$/ do |arg1|
pending
end
When /^I click the icon next to the note$/ do
# need selenium for this to check on the js
pending
end
Then /^I should see the note text$/ do
# need selenium for this to check on the js
pending
end
#------
Given "Luis has one project Pass Final Exam with no notes" do
@exam_project = @luis.projects.create!(:name => 'Pass Final Exam')
Then /^I should see the body of the notes$/ do
pending
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
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
#------ left over from old stories. can be removed if pending stuff is done
When "Luis adds a note from the Pass Final Exam project page" do
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
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
selenium.click "css=a.delete_note"
selenium.get_confirmation.should =~ /delete/
@ -113,10 +90,6 @@ When "Luis clicks Toggle Notes" do
clicks_link 'Toggle notes', :wait => :effects
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
should_see "new exam note"
end