handle and test the redirect when the goto-project checkbox is checked

This commit is contained in:
Reinier Balt 2010-10-16 17:22:55 +02:00
parent 4413cabbba
commit f284617513
4 changed files with 20 additions and 7 deletions

View file

@ -1,13 +1,14 @@
<% if @saved -%>
<% if @go_to_project %>
redirect_to ("<%= project_path(@project) %>")
<% end %>
<% if @go_to_project -%>
redirect_to ("<%= project_path(@project) -%>")
<% else -%>
hide_errors();
hide_empty_msg();
set_page_badge(<%= @down_count %>);
update_active_projects_container();
add_project();
clear_form();
<% end -%>
<% else -%>
show_errors();
<% end -%>

View file

@ -65,14 +65,19 @@ Feature: Manage the list of projects
When I follow "Create a new project »"
Then the new project form should be visible
@selenium, @wip
@selenium
Scenario: Adding a new project
When I go to the projects page
And I submit a new project with name "finish cucumber tests for project"
Then I should see "finish cucumber tests for project"
And I submit a new project with name "finish cucumber tests"
Then I should see "finish cucumber tests"
And the badge should show 4
And the project list badge for "active" projects should show 4
@selenium
Scenario: Adding a new project and take me to the project page
When I go to the projects page
And I submit a new project with name "finish cucumber tests" and select take me to the project
Then I should be on the "finish cucumber tests" project page
Scenario: Sorting the project alphabetically
Scenario: Sorting the project by number of task

View file

@ -31,6 +31,13 @@ When /^I submit a new project with name "([^"]*)"$/ do |project_name|
submit_new_project_form
end
When /^I submit a new project with name "([^"]*)" and select take me to the project$/ do |project_name|
fill_in "project[name]", :with => project_name
check "go_to_project"
submit_new_project_form
selenium.wait_for_page_to_load(5000) # follow the redirect
end
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
high_id = @current_user.projects.find_by_name(project_high).id
low_id = @current_user.projects.find_by_name(project_low).id

View file

@ -145,7 +145,7 @@ todoItems = {
}
function redirect_to(path) {
$(window.location).attr('href', path);
window.location.href = path;
}
function setup_container_toggles(){