From 907e60d0463fc79fc5b7e53f59c328c866394cd2 Mon Sep 17 00:00:00 2001 From: Suganthi T Date: Tue, 23 Oct 2012 16:42:51 +0530 Subject: [PATCH] #1353 - Prasanna/Suganthi - Fixed bugs in Admin update user page --- .rspec | 3 ++- Gemfile | 1 + Gemfile.lock | 2 ++ app/controllers/users_controller.rb | 3 ++- capybara_features/edit_user_details.feature | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.rspec b/.rspec index 6682824980..d09ccc9ad7 100644 --- a/.rspec +++ b/.rspec @@ -1,5 +1,6 @@ --color ---format progress --order default --backtrace --profile +--require rspec/instafail +--format RSpec::Instafail diff --git a/Gemfile b/Gemfile index da6533c9ba..c57cbf6a5d 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,7 @@ end group :test do gem 'mocha' gem 'test_declarative' + gem 'rspec-instafail' end group :cucumber do diff --git a/Gemfile.lock b/Gemfile.lock index 46d582c751..d47db5e32f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -158,6 +158,7 @@ GEM rspec-core (2.11.1) rspec-expectations (2.11.3) diff-lcs (~> 1.1.3) + rspec-instafail (0.2.4) rspec-mocks (2.11.2) rspec-rails (2.11.0) actionpack (>= 3.0) @@ -224,6 +225,7 @@ DEPENDENCIES rcov rest-client (= 1.3.0) rspec (= 2.11.0) + rspec-instafail rspec-rails (= 2.11.0) sass selenium-webdriver (= 2.24.0) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 186156ac32..7b516382b3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,7 +1,7 @@ class UsersController < ApplicationController before_filter :administrators_only, :except =>[:show, :edit, :update] - before_filter :set_permissions_params, :only => [:create ] + before_filter :set_permissions_params, :only => [:update, :create ] def index @users = User.view("by_full_name") @@ -79,6 +79,7 @@ def destroy private def set_permissions_params + return unless app_session.admin? permissions = [] user = params[:user] diff --git a/capybara_features/edit_user_details.feature b/capybara_features/edit_user_details.feature index bf018177d7..36191110c8 100644 --- a/capybara_features/edit_user_details.feature +++ b/capybara_features/edit_user_details.feature @@ -92,6 +92,7 @@ Scenario: Admin should not see "Disable" control or change user type control whe Scenario: User should be able to edit their own general information, but should not be able to edit their devices Given "mary" is logged in And I follow "Account" + And I click text "Edit" Then I should not see "IMEI" Then the "Organisation" field should be disabled