diff --git a/db/migrate/20161124062115_add_superadmin_to_admins.rb b/db/migrate/20161124062115_add_superadmin_to_admins.rb new file mode 100644 index 00000000..9214b0c5 --- /dev/null +++ b/db/migrate/20161124062115_add_superadmin_to_admins.rb @@ -0,0 +1,5 @@ +class AddSuperadminToAdmins < ActiveRecord::Migration + def change + add_column :admins, :superadmin, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index a55b4b56..00000000 --- a/db/schema.rb +++ /dev/null @@ -1,66 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 20161118165842) do - - create_table "admins", force: :cascade do |t| - t.string "name" - t.string "email" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "discussions", force: :cascade do |t| - t.integer "number" - t.string "time" - t.integer "capacity" - t.integer "submission_id" - t.string "day" - end - - add_index "discussions", ["submission_id"], name: "index_discussions_on_submission_id" - - create_table "submissions", force: :cascade do |t| - t.integer "disc1id" - t.integer "disc2id" - t.integer "disc3id" - t.integer "team_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "teams", force: :cascade do |t| - t.boolean "approved" - t.string "passcode" - t.integer "submission_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "submitted" - t.integer "discussion_id" - end - - add_index "teams", ["discussion_id"], name: "index_teams_on_discussion_id" - - create_table "users", force: :cascade do |t| - t.string "name", null: false - t.string "email", null: false - t.string "major", null: false - t.string "sid", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "team_id" - end - - add_index "users", ["team_id"], name: "index_users_on_team_id" - -end diff --git a/features/admins/super_admin_edit_admins.feature b/features/admins/super_admin_edit_admins.feature new file mode 100644 index 00000000..9c6cb3c7 --- /dev/null +++ b/features/admins/super_admin_edit_admins.feature @@ -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 "supreme_ruler@aol.com" + 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 "abc@abc.com" + 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 "supreme_ruler@aol.com" + 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" + \ No newline at end of file