Skip to content

Commit

Permalink
Superadmin feature (#79)
Browse files Browse the repository at this point in the history
* Superadmin feature (self deletion is already a feature

* Remove schema.rb from git

* PR feedback
  • Loading branch information
jjlgao authored Nov 24, 2016
1 parent 75613f8 commit 77722c1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 66 deletions.
5 changes: 5 additions & 0 deletions db/migrate/20161124062115_add_superadmin_to_admins.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSuperadminToAdmins < ActiveRecord::Migration
def change
add_column :admins, :superadmin, :boolean
end
end
66 changes: 0 additions & 66 deletions db/schema.rb

This file was deleted.

32 changes: 32 additions & 0 deletions features/admins/super_admin_edit_admins.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: Super admin deletes an admin

As a super admin
So that I can control other admins
I want to be able to delete them

Background:
Given the following admin exists
| name | email | password | superadmin |
| Bob | supreme_ruler@aol.com | ilikcats | true |
| Carol | abc@abc.com | abc | false |
And I am on the login page

Scenario: Super admin successfully deletes another admin
When I log in as an admin with email "[email protected]"
And PENDING: I press "Edit Admins"
And PENDING: I follow "delete_Carol"
Then PENDING: I should not see "Carol"

Scenario: Regular admin cannot access the super admin page
When I log in as an admin with email "[email protected]"
Then PENDING: I should not see "Edit Admins"

Scenario: Super Admin successfully transfers super admin ability to another
When I log in as an admin with email "[email protected]"
And PENDING: I press "Edit Admins"
And PENDING: I choose "transfer_Carol"
And PENDING: I press "Transfer"
Then PENDING: I should see "Admin powers transferred!"
And PENDING: I should be on the admin home page
And PENDING: I should not see "Edit Admins"

0 comments on commit 77722c1

Please sign in to comment.