I am getting error in cucumber tests:
You have insufficient privileges to perform action.
(ApplicationService::PermissionError)
./app/services/application_service.rb:72:in `require_privilege'
./app/controllers/users_controller.rb:10:in `index'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
./features/step_definitions/web_steps.rb:24:in `/^(?:|I )press
"([^"]*)"$/'
features/authentication.feature:25:in `And I press "Save"'
Failing Scenarios:
cucumber features/authentication.feature:19 # Scenario: Edit profile
Jirka
Dne 21.6.2011 17:37, jzigmund(a)redhat.com napsal(a):
From: Jozef Zigmund<jzigmund(a)redhat.com>
---
src/app/controllers/users_controller.rb | 2 +-
src/features/support/paths.rb | 7 +++++++
src/features/user.feature | 14 ++++++++++++++
3 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/users_controller.rb
b/src/app/controllers/users_controller.rb
index 1b4f7b5..580e0b9 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -90,7 +90,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 users_path
end
end
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..37d7314 100644
--- a/src/features/user.feature
+++ b/src/features/user.feature
@@ -88,6 +88,20 @@ 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"
+ And I press "Save"
+ 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"