diff --git a/app/views/projects/create.js.erb b/app/views/projects/create.js.erb index a72af52f..d756056b 100644 --- a/app/views/projects/create.js.erb +++ b/app/views/projects/create.js.erb @@ -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 -%> diff --git a/features/manage_list_of_projects.feature b/features/manage_list_of_projects.feature index 92b8ddc0..66730c08 100644 --- a/features/manage_list_of_projects.feature +++ b/features/manage_list_of_projects.feature @@ -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 \ No newline at end of file diff --git a/features/step_definitions/project_list_steps.rb b/features/step_definitions/project_list_steps.rb index d2e9ba56..209b2353 100644 --- a/features/step_definitions/project_list_steps.rb +++ b/features/step_definitions/project_list_steps.rb @@ -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 diff --git a/public/javascripts/application.js b/public/javascripts/application.js index ce8a36e2..8bc28b20 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -145,7 +145,7 @@ todoItems = { } function redirect_to(path) { - $(window.location).attr('href', path); + window.location.href = path; } function setup_container_toggles(){