diff --git a/app/controllers/admin/role_controller.rb b/app/controllers/admin/role_controller.rb index 55319b4..b4f4fe0 100644 --- a/app/controllers/admin/role_controller.rb +++ b/app/controllers/admin/role_controller.rb @@ -9,21 +9,6 @@ class RoleController < AdminController @role = environment.roles.find(params[:id]) end - def new - @role = Role.new - end - - def create - @role = Role.new(params[:role]) - @role.environment = environment - if @role.save - redirect_to :action => 'show', :id => @role - else - session[:notice] = _('Failed to create role') - render :action => 'new' - end - end - def edit @role = environment.roles.find(params[:id]) end @@ -38,13 +23,4 @@ class RoleController < AdminController end end - def destroy - @role = environment.roles.find(params[:id]) - if @role.destroy - redirect_to :action => 'index' - else - session[:notice] = _('Failed to edit role') - redirect_to :action => 'index' - end - end end diff --git a/app/views/role/index.rhtml b/app/views/role/index.rhtml index f54a112..a77a5ba 100644 --- a/app/views/role/index.rhtml +++ b/app/views/role/index.rhtml @@ -12,13 +12,11 @@ <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => role %> - <%= button_without_text :delete, _('Destroy'), :action => 'destroy', :id => role %> <% end %> <% button_bar do %> - <%= button :new, _('New role'), :action => 'new' %> <%= button :back, _('Back'), :controller => 'admin_panel' %> <% end %> diff --git a/app/views/role/new.rhtml b/app/views/role/new.rhtml deleted file mode 100644 index 98b0c29..0000000 --- a/app/views/role/new.rhtml +++ /dev/null @@ -1,6 +0,0 @@ -

<%= _('New Role') %>

- -<% ActiveRecord::Base::PERMISSIONS.keys.each do |perm_class| %> -

<%= gettext(perm_class) %>

- <%= render :partial => 'form', :locals => { :mode => :new, :role => @role, :permissions => ActiveRecord::Base::PERMISSIONS[perm_class] } %> -<% end %> diff --git a/test/functional/role_controller_test.rb b/test/functional/role_controller_test.rb index 9ab2fcd..ef7f284 100644 --- a/test/functional/role_controller_test.rb +++ b/test/functional/role_controller_test.rb @@ -38,22 +38,6 @@ class RoleControllerTest < Test::Unit::TestCase assert_equal @role.id, assigns(:role).id end - def test_should_create_with_valid_paramters - Role.any_instance.stubs(:valid?).returns(true) - post 'create' - assert !assigns(:role).new_record? - assert_nil session[:notice] - assert_response :redirect - end - - def test_should_not_create_with_invalid_paramters - Role.any_instance.stubs(:valid?).returns(false) - post 'create' - assert assigns(:role).new_record? - assert_not_nil session[:notice] - assert_response :success - end - def test_can_edit get 'edit', :id => @role.id assert_not_nil assigns(:role) @@ -76,13 +60,6 @@ class RoleControllerTest < Test::Unit::TestCase assert_not_nil session[:notice] end - def test_should_destroy - assert_difference Role, :count, -1 do - post 'destroy', :id => @role.id - assert_not_nil assigns(:role) - end - end - should 'not crash when editing role with no permissions' do role = Role.create!(:name => 'test_role', :environment => Environment.default) -- libgit2 0.21.2