From e7733b8bf0bd5bebdbc8534c6a23d45807efc35e Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Wed, 14 Feb 2018 22:12:14 -0500 Subject: [PATCH] Update Monban to Oath --- Gemfile | 5 +- Gemfile.lock | 19 +++--- .../admin/application_controller.rb | 2 +- app/controllers/application_controller.rb | 2 +- config/routes.rb | 4 +- db/schema.rb | 60 +++++++++---------- spec/models/contact_spec.rb | 10 ++-- 7 files changed, 48 insertions(+), 54 deletions(-) diff --git a/Gemfile b/Gemfile index 0622c6b..ead02e5 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,6 @@ end group :test do gem 'factory_girl_rails' gem 'shoulda' - gem 'shoulda-context' gem 'shoulda-matchers' gem 'poltergeist' gem 'database_cleaner' @@ -58,8 +57,8 @@ gem 'administrate-field-image' gem 'dragonfly' gem 'dragonfly-s3_data_store' gem 'kaminari' -gem 'monban' -gem 'monban-generators' +gem 'oath' +gem 'oath-generators' gem 'nokogiri' gem 'pg' gem 'kramdown' diff --git a/Gemfile.lock b/Gemfile.lock index 504b98c..81a2bc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -180,16 +180,16 @@ GEM minitest (5.11.3) momentjs-rails (2.17.1) railties (>= 3.1) - monban (1.1.1) - bcrypt - rails - warden - monban-generators (1.0.1) - monban (>= 0.0.12) multi_json (1.13.1) nio4r (2.2.0) nokogiri (1.8.2) mini_portile2 (~> 2.3.0) + oath (1.1.0) + bcrypt + rails + warden + oath-generators (1.0.1) + oath (>= 0.0.12) parallel (1.12.1) parser (2.4.0.2) ast (~> 2.3) @@ -351,9 +351,9 @@ DEPENDENCIES kaminari kramdown letter_opener - monban - monban-generators nokogiri + oath + oath-generators pg poltergeist powder @@ -367,7 +367,6 @@ DEPENDENCIES ruby_parser sass-rails shoulda - shoulda-context shoulda-matchers simple_form simplecov @@ -379,4 +378,4 @@ RUBY VERSION ruby 2.4.2p198 BUNDLED WITH - 1.16.0 + 1.16.1 diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index 273ff84..960c8fc 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -6,7 +6,7 @@ # you're free to overwrite the RESTful controller actions. module Admin class ApplicationController < Administrate::ApplicationController - include Monban::ControllerHelpers + include Oath::ControllerHelpers before_action :require_login diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 199840c..d183a8a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ class ApplicationController < ActionController::Base - include Monban::ControllerHelpers + include Oath::ControllerHelpers protect_from_forgery rescue_from ActiveRecord::RecordNotFound, with: :render_404 diff --git a/config/routes.rb b/config/routes.rb index a1309a5..064bf9c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ -require 'monban/constraints/signed_in' -require 'monban/constraints/signed_out' +require 'oath/constraints/signed_in' +require 'oath/constraints/signed_out' DanBarberPhoto::Application.routes.draw do namespace :admin do diff --git a/db/schema.rb b/db/schema.rb index 0b54404..2092320 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# 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. @@ -17,63 +16,60 @@ ActiveRecord::Schema.define(version: 20151028124718) do enable_extension "plpgsql" create_table "categories", force: :cascade do |t| - t.string "name", limit: 255 - t.text "description" + t.string "name", limit: 255 + t.text "description" t.datetime "created_at" t.datetime "updated_at" - t.integer "photo_id" - t.string "base_colour", limit: 255 - t.integer "sort" - t.string "slug", limit: 255 + t.integer "photo_id" + t.string "base_colour", limit: 255 + t.integer "sort" + t.string "slug", limit: 255 end create_table "categories_photos", id: false, force: :cascade do |t| t.integer "category_id" t.integer "photo_id" + t.index ["category_id", "photo_id"], name: "index_categories_photos_on_category_id_and_photo_id", unique: true end - add_index "categories_photos", ["category_id", "photo_id"], name: "index_categories_photos_on_category_id_and_photo_id", unique: true, using: :btree - create_table "pages", force: :cascade do |t| - t.string "name", limit: 255 - t.string "title", limit: 255 - t.text "content" + t.string "name", limit: 255 + t.string "title", limit: 255 + t.text "content" t.datetime "created_at" t.datetime "updated_at" end create_table "photos", force: :cascade do |t| - t.string "flickr_url", limit: 255 + t.string "flickr_url", limit: 255 t.datetime "created_at" t.datetime "updated_at" - t.string "title", limit: 255 - t.text "description" - t.integer "sort" - t.boolean "featured", default: false - t.boolean "enabled", default: true + t.string "title", limit: 255 + t.text "description" + t.integer "sort" + t.boolean "featured", default: false + t.boolean "enabled", default: true t.datetime "taken_at" - t.integer "views", default: 0 - t.string "image_uid", limit: 255 - t.string "image_name", limit: 255 + t.integer "views", default: 0 + t.string "image_uid", limit: 255 + t.string "image_name", limit: 255 end create_table "sessions", force: :cascade do |t| - t.string "session_id", limit: 255, null: false - t.text "data" + t.string "session_id", limit: 255, null: false + t.text "data" t.datetime "created_at" t.datetime "updated_at" + t.index ["session_id"], name: "index_sessions_on_session_id" + t.index ["updated_at"], name: "index_sessions_on_updated_at" end - add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree - add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree - create_table "users", force: :cascade do |t| - t.string "email", null: false - t.string "password_digest", limit: 60, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "email", null: false + t.string "password_digest", limit: 60, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email"], name: "index_users_on_email", unique: true end - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - end diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index e0b2d63..9132346 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -1,12 +1,12 @@ require "spec_helper" describe Contact do - it { should validate_presence_of(:email) } - it { should validate_presence_of(:name) } - it { should validate_presence_of(:message) } + it { is_expected.to validate_presence_of(:email) } + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:message) } - it { should allow_value("test@test.com").for(:email) } - it { should_not allow_value("test@test").for(:email) } + it { is_expected.to allow_value('test@test.com').for(:email) } + it { is_expected.not_to allow_value('test@test').for(:email) } let(:contact) { build(:contact) } end