--- src/app/controllers/users_controller.rb | 2 +- src/features/authentication.feature | 2 +- src/features/support/paths.rb | 7 +++++++ src/features/user.feature | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb index 9892b82..16c514d 100644 --- a/src/app/controllers/users_controller.rb +++ b/src/app/controllers/users_controller.rb @@ -89,7 +89,7 @@ class UsersController < ApplicationController render :action => 'edit' and return else flash[:notice] = "User updated!" - redirect_to (@user == current_user) ? root_url : users_url + redirect_to user_path(@user) end end
diff --git a/src/features/authentication.feature b/src/features/authentication.feature index ee8a465..4720cba 100644 --- a/src/features/authentication.feature +++ b/src/features/authentication.feature @@ -23,7 +23,7 @@ Feature: User authentication Then should see "Editing Account" When I fill in "E-mail" with "changed@example.com" And I press "Save" - Then I should be on the root page + Then I should be on the user page And I should see "User updated!"
Scenario: log out diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb index fc86294..12a72d5 100644 --- a/src/features/support/paths.rb +++ b/src/features/support/paths.rb @@ -117,6 +117,13 @@ module NavigationHelpers pool = Pool.find_by_name($1) pool_path(pool, :view => 'filter')
+ when /^the (.*)'s user page$/ + user_path(User.find_by_login($1)) + + when /^the (.*)'s edit user page$/ + edit_user_path(User.find_by_login($1)) + + # Add more mappings here. # Here is an example that pulls values out of the Regexp: # diff --git a/src/features/user.feature b/src/features/user.feature index 59e3f42..e26b4b3 100644 --- a/src/features/user.feature +++ b/src/features/user.feature @@ -88,6 +88,21 @@ Feature: Manage Users Then I should be on the users page And there should not be user with login "canceluser"
+ @tag + Scenario: Edit existing user + Given I am on the users page + And I follow "testuser" + Then I should be on the testuser's user page + And I should see "John" + When I follow "Edit" + Then I should be on the testuser's edit user page + And I fill in "user_first_name" with "Joe" + When I press "Save" + Then I should be on the testuser's user page + And I should see "User updated!" + And I should see "Joe" + + # Scenario: Search for users # Given there is a user "myuser" # And there is a user "someuser"