fix #1042 and create test for it

This commit is contained in:
Reinier Balt 2010-08-03 20:55:07 +02:00
parent a9726766b3
commit 6be18a104b
6 changed files with 72 additions and 37 deletions

View file

@ -34,3 +34,22 @@ Feature: Manage a project
When I visit the "bananas" project
And I edit the project name to "cherries"
Then the project title should be "cherries"
# Ticket #1042
@selenium
Scenario: I cannot change the name of a project in the project view to the name of another existing project
Given I have a project "test" with 1 todos
When I go to the projects page
Then the badge should show 2 # "manage me" and "test"
When I visit the "manage me" project
And I edit the project name to "test"
Then I should see "Name already exists"
# Ticket #1042
@selenium
Scenario: I cannot change the name of a project in the project list view to the name of another existing project
Given I have a project "test" with 1 todos
When I go to the projects page
Then the badge should show 2 # "manage me" and "test"
When I edit the project name of "manage me" to "test"
Then I should see "Name already exists"

View file

@ -43,10 +43,20 @@ end
When /^I edit the project name to "([^\"]*)"$/ do |new_title|
click_link "link_edit_project_#{@project.id}"
fill_in "project[name]", :with => new_title
# changed to make sure selenium waits until the saving has a result either
# positive or negative. Was: :element=>"flash", :text=>"Project saved"
# we may need to change it back if you really need a positive outcome, i.e.
# this step needs to fail if the project was not saved succesfully
selenium.click "submit_project_#{@project.id}",
:wait_for => :text,
:element => "flash",
:text => "Project saved"
:text => /(Project saved|1 error prohibited this project from being saved)/
end
When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
@project = @current_user.projects.find_by_name(project_current_name)
@project.should_not be_nil
When "I edit the project name to \"#{project_new_name}\""
end
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bold|
@ -69,4 +79,4 @@ end
Then /^the project title should be "(.*)"$/ do |title|
selenium.get_text("css=h2#project_name").should == title
end
end