tb_blog 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c3f0e49fcb5e713ca2539e045f2ffb5d0e35546d
4
- data.tar.gz: 2661478bca463998d924ab06d4c8cdf6684decde
2
+ SHA256:
3
+ metadata.gz: cbe8c652f950675c30d1c0e0c2d046b0376bfbd5d5d4c9f82dd5a81b21f2885c
4
+ data.tar.gz: 136054d5081e1848581982460b769c01b0ec603f17db51f2db5043c50968ab43
5
5
  SHA512:
6
- metadata.gz: c8b835b9f998af0cffce8387ee034038972f0409dcf86ff1fc27073fb597b003b75f872328b74da4a58376e1f8447591a58fd9da94c15287eb230e9ded245cfe
7
- data.tar.gz: 45f3c1bec9ac7dbcf32d3afd332d93b8012c7895dd0786cabe63483f8bb8970871c753010f31b53c30015ce0d6a22f41a511416be8c990eeed77ff52c5a224d8
6
+ metadata.gz: a1c1a8977aa48a0ab99a4ee993fc9e32a5d31ccb6e8331536c51de72945320684fa683becf7a686121d748cfc9ec85184e962f3a07b279edce85cf90f1d6545b
7
+ data.tar.gz: 8ff155075d407d382f48007f03f00754628b623091426afebc4c340fa8a371833836ffacf3974d6eb490b582c74b2a39264a749ce1b6f705445339496add7a6f
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
23
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
26
  Bundler::GemHelper.install_tasks
@@ -15,11 +15,11 @@ class Admin::PostCategoriesController < Admin::ApplicationController
15
15
  end
16
16
 
17
17
  def update
18
- if @post_category.update_attributes(category_params)
18
+ if @post_category.update(category_params)
19
19
  flash.now[:notice] = 'Post Category was successfully updated'
20
20
  respond_with @post_category, location: admin_post_categories_path
21
21
  else
22
- render 'new', status: 422
22
+ render 'new', status: :unprocessable_entity
23
23
  end
24
24
  end
25
25
 
@@ -34,7 +34,7 @@ class Admin::PostCategoriesController < Admin::ApplicationController
34
34
  flash.now[:notice] = 'Post Category was successfully created'
35
35
  respond_with @post_category, location: admin_post_categories_path
36
36
  else
37
- render 'new', status: 422
37
+ render 'new', status: :unprocessable_entity
38
38
  end
39
39
  end
40
40
 
@@ -21,9 +21,7 @@ class Admin::PostsController < Admin::ApplicationController
21
21
  end
22
22
 
23
23
  def update
24
- if @post.update_attributes(post_params)
25
- flash[:notice] = 'Post was successfully updated.'
26
- end
24
+ flash[:notice] = 'Post was successfully updated.' if @post.update(post_params)
27
25
  respond_with @post, location: admin_posts_path
28
26
  end
29
27
 
@@ -66,9 +64,7 @@ class Admin::PostsController < Admin::ApplicationController
66
64
 
67
65
  def post_params
68
66
  permitted = [:published_at, :title, :content, :spud_user_id, :url_name, :visible, :comments_enabled, :meta_keywords, :meta_description, :content_format, :custom_author, category_ids: []]
69
- if Spud::Blog.permitted_attributes.present?
70
- permitted += Spud::Blog.permitted_attributes
71
- end
67
+ permitted += Spud::Blog.permitted_attributes if Spud::Blog.permitted_attributes.present?
72
68
  p = params.require(:spud_post).permit(permitted)
73
69
  p[:updated_at] = DateTime.now
74
70
  return p
@@ -20,11 +20,11 @@ class PostsController < ApplicationController
20
20
 
21
21
  # The sole purpose of this action is to redirect from a POST to an seo-friendly url
22
22
  def filter
23
- if !params[:category_url_name].blank? && !params[:archive_date].blank?
23
+ if params[:category_url_name].present? && params[:archive_date].present?
24
24
  redirect_to post_category_archive_path(params[:category_url_name], params[:archive_date])
25
- elsif !params[:category_url_name].blank?
25
+ elsif params[:category_url_name].present?
26
26
  redirect_to post_category_path(params[:category_url_name])
27
- elsif !params[:archive_date].blank?
27
+ elsif params[:archive_date].present?
28
28
  redirect_to post_archive_path(params[:archive_date])
29
29
  else
30
30
  redirect_to posts_path
@@ -33,7 +33,7 @@ class PostsController < ApplicationController
33
33
 
34
34
  def category
35
35
  if @post_category = SpudPostCategory.find_by(url_name: params[:category_url_name])
36
- @posts = @post_category.posts.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).paginate(page: @page_number, per_page: Spud::Blog.config.posts_per_page)
36
+ @posts = @post_category.posts.for_user(current_user).visible.for_blog(params[:blog_key]).from_archive(params[:archive_date]).ordered.paginate(page: @page_number, per_page: Spud::Blog.config.posts_per_page)
37
37
  else
38
38
  redirect_to posts_path
39
39
  return
@@ -60,7 +60,7 @@ class PostsController < ApplicationController
60
60
 
61
61
  def find_post
62
62
  @post = SpudPost.for_user(current_user).for_blog(params[:blog_key]).where(url_name: params[:id]).first
63
- raise Spud::NotFoundError, item: 'post' if @post.blank? || @post.is_private?
63
+ raise TbCore::NotFoundError, item: 'post' if @post.blank? || @post.is_private?
64
64
  end
65
65
 
66
66
  def load_page_number
@@ -81,7 +81,7 @@ class PostsController < ApplicationController
81
81
  def load_blog
82
82
  @config = SpudBlogConfig.find(params[:blog_key])
83
83
  if @config.blank?
84
- raise Spud::NotFoundError(item: 'blog')
84
+ raise TbCore::NotFoundError(item: 'blog')
85
85
  else
86
86
  self.class.layout(@config.layout)
87
87
  end
@@ -13,7 +13,7 @@ module Admin::PostsHelper
13
13
 
14
14
  def link_to_disqus_comment_count(post)
15
15
  # TODO: It would be great to link directly to the thread
16
- # ie: https://myblog.disqus.com/admin/moderate/#/all/search/thread:4584301535
16
+ # ie: https://myblog.disqus.com/admin/moderate/#/all/search/thread:4584301535
17
17
  #
18
18
  # However, we do not know the thread ID at this time. We may be able to fetch it
19
19
  # via the Disqus JavaScript API.
@@ -19,7 +19,7 @@ module BlogHelper
19
19
  end
20
20
 
21
21
  def spud_blog_rss_link
22
- return tag :link, rel: 'alternate', type: 'application/rss+xml', title: "#{Spud::Core.site_name} Blog RSS", href: posts_path(format: :rss)
22
+ return tag :link, rel: 'alternate', type: 'application/rss+xml', title: "#{TbCore.site_name} Blog RSS", href: posts_path(format: :rss)
23
23
  end
24
24
 
25
25
  def disqus_comment_count_for_post(post)
@@ -1,3 +1,3 @@
1
- class SpudPost < Spud::SpudPostModel
1
+ class SpudPost < TbCore::SpudPostModel
2
2
  # Copy this file to your app to extend the base SpudPost model
3
3
  end
@@ -1,5 +1,4 @@
1
1
  class SpudPostCategory < ActiveRecord::Base
2
- spud_searchable
3
2
 
4
3
  has_and_belongs_to_many :posts,
5
4
  class_name: 'SpudPost',
@@ -2,7 +2,7 @@ class SpudPostSite < ActiveRecord::Base
2
2
  belongs_to :spud_post
3
3
 
4
4
  def spud_site
5
- return Spud::Core.site_config_for_id(spud_site_id)
5
+ return TbCore.site_config_for_id(spud_site_id)
6
6
  end
7
7
 
8
8
  end
@@ -1,10 +1,8 @@
1
- class Spud::SpudPostModel < ActiveRecord::Base
1
+ class TbCore::SpudPostModel < ActiveRecord::Base
2
2
  include TbRedirects::HasRedirects
3
3
 
4
4
  self.table_name = 'spud_posts'
5
5
 
6
- spud_searchable
7
-
8
6
  has_many :spud_post_categories_posts, foreign_key: 'spud_post_id'
9
7
  has_many :categories,
10
8
  class_name: 'SpudPostCategory',
@@ -54,7 +52,7 @@ class Spud::SpudPostModel < ActiveRecord::Base
54
52
  def self.from_archive(date_string)
55
53
  date = Date.strptime(date_string, '%Y-%b')
56
54
  return where(published_at: date..date.end_of_month)
57
- rescue
55
+ rescue StandardError
58
56
  logger.debug 'fallback'
59
57
  return where('')
60
58
  end
@@ -112,8 +110,10 @@ class Spud::SpudPostModel < ActiveRecord::Base
112
110
  def author_name
113
111
  if custom_author.present?
114
112
  custom_author
115
- else
113
+ elsif author.present?
116
114
  author.full_name
115
+ else
116
+ ''
117
117
  end
118
118
  end
119
119
 
@@ -1,9 +1,9 @@
1
- xml.instruct! :xml, :version => "1.0"
2
- xml.rss :version => "2.0" do
1
+ xml.instruct! :xml, version: '1.0'
2
+ xml.rss version: '2.0' do
3
3
  xml.channel do
4
- xml.title "#{Spud::Core.site_name} Blog Articles"
5
- xml.description "Blog articles for #{Spud::Core.site_name}"
6
- xml.link posts_path(:format => :rss)
4
+ xml.title "#{TbCore.site_name} Blog Articles"
5
+ xml.description "Blog articles for #{TbCore.site_name}"
6
+ xml.link posts_path(format: :rss)
7
7
 
8
8
  for article in @posts
9
9
  xml.item do
@@ -35,7 +35,7 @@ class Spud::Blog::RandomPostsGenerator < ::Rails::Generators::Base
35
35
 
36
36
  def random_word
37
37
  chars = 'abcdefghjkmnpqrstuvwxyz'
38
- length = rand(8) + 1
38
+ length = rand(1..8)
39
39
  return (1..length).collect { chars[rand(chars.length)] }.join('')
40
40
  end
41
41
 
@@ -45,22 +45,22 @@ module Spud
45
45
  url: "admin/#{config.key}",
46
46
  thumbnail: 'admin/posts_thumb.png'
47
47
  }
48
- Spud::Core.config.admin_applications += [blog_app]
48
+ TbCore.config.admin_applications += [blog_app]
49
49
  end
50
50
  end
51
51
 
52
52
  initializer 'tb_blog.assets' do
53
- Spud::Core.append_admin_javascripts('admin/blog/application')
54
- Spud::Core.append_admin_stylesheets('admin/blog/application')
53
+ TbCore.append_admin_javascripts('admin/blog/application')
54
+ TbCore.append_admin_stylesheets('admin/blog/application')
55
55
  Rails.application.config.assets.precompile += ['admin/posts_thumb.png', 'admin/news_thumb.png']
56
56
  end
57
57
 
58
58
  # Triggers a I18n.enforce_available_locales deprecation warning. Why?
59
- # initializer 'tb_blog.user_association', :after => 'tb_core.model_overrides' do
60
- # SpudUser.class_eval do
61
- # has_many :posts, :class_name => 'SpudPost'
62
- # end
63
- # end
59
+ initializer 'tb_blog.user_association', after: 'tb_core.model_overrides' do
60
+ SpudUser.class_eval do
61
+ has_many :posts, class_name: 'SpudPost', dependent: :nullify
62
+ end
63
+ end
64
64
  end
65
65
  end
66
66
  end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = '1.4.1'.freeze
3
+ VERSION = '1.4.2'.freeze
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ describe Admin::PostsController, type: :controller do
8
8
 
9
9
  describe '#create_redirect_if_necessary' do
10
10
  before(:each) do
11
- @post = FactoryGirl.create(:spud_post)
11
+ @post = FactoryBot.create(:spud_post)
12
12
  end
13
13
 
14
14
  it 'should create a redirect' do
@@ -34,7 +34,7 @@ describe Admin::PostsController, type: :controller do
34
34
  end
35
35
  context 'with an existing post' do
36
36
  it 'should set the attributes without saving' do
37
- @post = FactoryGirl.create(:spud_post)
37
+ @post = FactoryBot.create(:spud_post)
38
38
  expect do
39
39
  post :preview, params: { blog_key: @post.blog_key, post_id: @post.id, spud_post: { title: 'Hello World' } }
40
40
  @post.reload
@@ -8,7 +8,7 @@ describe PostsController, type: :controller do
8
8
 
9
9
  describe 'index' do
10
10
  it 'should display a list of posts' do
11
- 2.times { |_i| FactoryGirl.create(:spud_post) }
11
+ 2.times { |_i| FactoryBot.create(:spud_post) }
12
12
  get :index, params: { blog_key: 'blog' }
13
13
  expect(assigns(:posts).count).to be > 1
14
14
  end
@@ -29,7 +29,7 @@ describe PostsController, type: :controller do
29
29
 
30
30
  describe 'show' do
31
31
  it 'renders the post' do
32
- post = FactoryGirl.create(:spud_post)
32
+ post = FactoryBot.create(:spud_post)
33
33
  get :show, params: { blog_key: post.blog_key, id: post.url_name }
34
34
  expect(response).to have_http_status(:success)
35
35
  end
@@ -1,3 +1,3 @@
1
- class ApplicationController < Spud::ApplicationController
1
+ class ApplicationController < TbCore::ApplicationController
2
2
  protect_from_forgery
3
3
  end
@@ -22,13 +22,6 @@ Dummy::Application.configure do
22
22
  # Only use best-standards-support built into browsers
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
-
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
31
-
32
25
  # Do not compress assets
33
26
  config.assets.compress = false
34
27
 
@@ -60,8 +60,4 @@ Dummy::Application.configure do
60
60
 
61
61
  # Send deprecation notices to registered listeners
62
62
  config.active_support.deprecation = :notify
63
-
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
63
  end
@@ -4,5 +4,5 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '3a89d4b95c1fd9c3d43623d8e2b5a907988d00bfdbfb6de2ae26b760a49fcdc86937728b8cdf3301e4df1342c5f44a3d8d83410d857e341f1907c9c467b9bcf4'
7
+ # Dummy::Application.config.secret_token = '3a89d4b95c1fd9c3d43623d8e2b5a907988d00bfdbfb6de2ae26b760a49fcdc86937728b8cdf3301e4df1342c5f44a3d8d83410d857e341f1907c9c467b9bcf4'
8
8
  Dummy::Application.config.secret_key_base = '83ed28f1288f2f059bc8f642f2acb0606ed8b46a3490bee501c1223d3acac326c325b2a97f3b984dda20828815aa123c911970579df1faaedefa21613b05630d'
@@ -0,0 +1,26 @@
1
+ # This migration comes from active_storage (originally 20170806125915)
2
+ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3
+ def change
4
+ create_table :active_storage_blobs do |t|
5
+ t.string :key, null: false
6
+ t.string :filename, null: false
7
+ t.string :content_type
8
+ t.text :metadata
9
+ t.bigint :byte_size, null: false
10
+ t.string :checksum, null: false
11
+ t.datetime :created_at, null: false
12
+
13
+ t.index [ :key ], unique: true
14
+ end
15
+
16
+ create_table :active_storage_attachments do |t|
17
+ t.string :name, null: false
18
+ t.references :record, null: false, polymorphic: true, index: false
19
+ t.references :blob, null: false
20
+
21
+ t.datetime :created_at, null: false
22
+
23
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
24
+ end
25
+ end
26
+ end
@@ -10,117 +10,138 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20161020155452) do
13
+ ActiveRecord::Schema.define(version: 2018_07_30_141254) do
14
14
 
15
- create_table "spud_permissions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
16
- t.string "name", null: false
17
- t.string "tag", null: false
15
+ create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
16
+ t.string "name", null: false
17
+ t.string "record_type", null: false
18
+ t.bigint "record_id", null: false
19
+ t.bigint "blob_id", null: false
20
+ t.datetime "created_at", null: false
21
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
22
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
23
+ end
24
+
25
+ create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
26
+ t.string "key", null: false
27
+ t.string "filename", null: false
28
+ t.string "content_type"
29
+ t.text "metadata"
30
+ t.bigint "byte_size", null: false
31
+ t.string "checksum", null: false
32
+ t.datetime "created_at", null: false
33
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
34
+ end
35
+
36
+ create_table "spud_permissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
37
+ t.string "name", null: false
38
+ t.string "tag", null: false
18
39
  t.datetime "created_at"
19
40
  t.datetime "updated_at"
20
- t.index ["tag"], name: "index_spud_permissions_on_tag", unique: true, using: :btree
41
+ t.index ["tag"], name: "index_spud_permissions_on_tag", unique: true
21
42
  end
22
43
 
23
- create_table "spud_post_categories", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
24
- t.string "name"
44
+ create_table "spud_post_categories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
45
+ t.string "name"
25
46
  t.datetime "created_at"
26
47
  t.datetime "updated_at"
27
- t.string "url_name"
28
- t.index ["url_name"], name: "index_spud_post_categories_on_url_name", using: :btree
48
+ t.string "url_name"
49
+ t.index ["url_name"], name: "index_spud_post_categories_on_url_name"
29
50
  end
30
51
 
31
- create_table "spud_post_categories_posts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
52
+ create_table "spud_post_categories_posts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
32
53
  t.integer "spud_post_id"
33
54
  t.integer "spud_post_category_id"
34
- t.index ["spud_post_category_id"], name: "index_spud_post_categories_posts_on_spud_post_category_id", using: :btree
55
+ t.index ["spud_post_category_id"], name: "index_spud_post_categories_posts_on_spud_post_category_id"
35
56
  end
36
57
 
37
- create_table "spud_posts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
38
- t.integer "spud_user_id"
39
- t.string "title"
40
- t.text "content", limit: 65535
41
- t.boolean "comments_enabled", default: false
42
- t.boolean "visible", default: true
58
+ create_table "spud_posts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
59
+ t.integer "spud_user_id"
60
+ t.string "title"
61
+ t.text "content"
62
+ t.boolean "comments_enabled", default: false
63
+ t.boolean "visible", default: true
43
64
  t.datetime "published_at"
44
65
  t.datetime "created_at"
45
66
  t.datetime "updated_at"
46
- t.string "url_name"
47
- t.boolean "is_news", default: false
48
- t.string "meta_keywords"
49
- t.text "meta_description", limit: 65535
50
- t.string "content_format", default: "HTML"
51
- t.text "content_processed", limit: 65535
52
- t.string "blog_key"
53
- t.string "custom_author"
54
- t.string "identifier"
55
- t.index ["blog_key"], name: "index_spud_posts_on_blog_key", using: :btree
56
- t.index ["identifier"], name: "index_spud_posts_on_identifier", unique: true, using: :btree
57
- t.index ["is_news"], name: "index_spud_posts_on_is_news", using: :btree
58
- t.index ["spud_user_id"], name: "index_spud_posts_on_spud_user_id", using: :btree
59
- t.index ["url_name"], name: "index_spud_posts_on_url_name", using: :btree
60
- t.index ["visible"], name: "index_spud_posts_on_visible", using: :btree
67
+ t.string "url_name"
68
+ t.boolean "is_news", default: false
69
+ t.string "meta_keywords"
70
+ t.text "meta_description"
71
+ t.string "content_format", default: "HTML"
72
+ t.text "content_processed"
73
+ t.string "blog_key"
74
+ t.string "custom_author"
75
+ t.string "identifier"
76
+ t.index ["blog_key"], name: "index_spud_posts_on_blog_key"
77
+ t.index ["identifier"], name: "index_spud_posts_on_identifier", unique: true
78
+ t.index ["is_news"], name: "index_spud_posts_on_is_news"
79
+ t.index ["spud_user_id"], name: "index_spud_posts_on_spud_user_id"
80
+ t.index ["url_name"], name: "index_spud_posts_on_url_name"
81
+ t.index ["visible"], name: "index_spud_posts_on_visible"
61
82
  end
62
83
 
63
- create_table "spud_role_permissions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
64
- t.integer "spud_role_id", null: false
65
- t.string "spud_permission_tag", null: false
84
+ create_table "spud_role_permissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
85
+ t.integer "spud_role_id", null: false
86
+ t.string "spud_permission_tag", null: false
66
87
  t.datetime "created_at"
67
88
  t.datetime "updated_at"
68
- t.index ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag", using: :btree
69
- t.index ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id", using: :btree
89
+ t.index ["spud_permission_tag"], name: "index_spud_role_permissions_on_spud_permission_tag"
90
+ t.index ["spud_role_id"], name: "index_spud_role_permissions_on_spud_role_id"
70
91
  end
71
92
 
72
- create_table "spud_roles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
73
- t.string "name"
93
+ create_table "spud_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
94
+ t.string "name"
74
95
  t.datetime "created_at"
75
96
  t.datetime "updated_at"
76
97
  end
77
98
 
78
- create_table "spud_user_settings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
79
- t.integer "spud_user_id"
80
- t.string "key"
81
- t.string "value"
99
+ create_table "spud_user_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
100
+ t.integer "spud_user_id"
101
+ t.string "key"
102
+ t.string "value"
82
103
  t.datetime "created_at"
83
104
  t.datetime "updated_at"
84
105
  end
85
106
 
86
- create_table "spud_users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
87
- t.string "first_name"
88
- t.string "last_name"
89
- t.boolean "super_admin"
90
- t.string "login", null: false
91
- t.string "email", null: false
92
- t.string "crypted_password", null: false
93
- t.string "password_salt", null: false
94
- t.string "persistence_token", null: false
95
- t.string "single_access_token", null: false
96
- t.string "perishable_token", null: false
97
- t.integer "login_count", default: 0, null: false
98
- t.integer "failed_login_count", default: 0, null: false
107
+ create_table "spud_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
108
+ t.string "first_name"
109
+ t.string "last_name"
110
+ t.boolean "super_admin"
111
+ t.string "login", null: false
112
+ t.string "email", null: false
113
+ t.string "crypted_password", null: false
114
+ t.string "password_salt", null: false
115
+ t.string "persistence_token", null: false
116
+ t.string "single_access_token", null: false
117
+ t.string "perishable_token", null: false
118
+ t.integer "login_count", default: 0, null: false
119
+ t.integer "failed_login_count", default: 0, null: false
99
120
  t.datetime "last_request_at"
100
121
  t.datetime "current_login_at"
101
122
  t.datetime "last_login_at"
102
- t.string "current_login_ip"
103
- t.string "last_login_ip"
123
+ t.string "current_login_ip"
124
+ t.string "last_login_ip"
104
125
  t.datetime "created_at"
105
126
  t.datetime "updated_at"
106
- t.string "time_zone"
107
- t.integer "spud_role_id"
108
- t.boolean "requires_password_change", default: false
109
- t.index ["email"], name: "index_spud_users_on_email", using: :btree
110
- t.index ["login"], name: "index_spud_users_on_login", using: :btree
111
- t.index ["spud_role_id"], name: "index_spud_users_on_spud_role_id", using: :btree
127
+ t.string "time_zone"
128
+ t.integer "spud_role_id"
129
+ t.boolean "requires_password_change", default: false
130
+ t.index ["email"], name: "index_spud_users_on_email"
131
+ t.index ["login"], name: "index_spud_users_on_login"
132
+ t.index ["spud_role_id"], name: "index_spud_users_on_spud_role_id"
112
133
  end
113
134
 
114
- create_table "tb_redirects", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
115
- t.string "owner_type"
116
- t.integer "owner_id"
117
- t.string "source", null: false
118
- t.string "destination", null: false
119
- t.string "created_by"
120
- t.datetime "created_at", null: false
121
- t.datetime "updated_at", null: false
122
- t.index ["owner_type", "owner_id"], name: "index_tb_redirects_on_owner_type_and_owner_id", using: :btree
123
- t.index ["source"], name: "index_tb_redirects_on_source", unique: true, using: :btree
135
+ create_table "tb_redirects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
136
+ t.string "owner_type"
137
+ t.integer "owner_id"
138
+ t.string "source", null: false
139
+ t.string "destination", null: false
140
+ t.string "created_by"
141
+ t.datetime "created_at", null: false
142
+ t.datetime "updated_at", null: false
143
+ t.index ["owner_type", "owner_id"], name: "index_tb_redirects_on_owner_type_and_owner_id"
144
+ t.index ["source"], name: "index_tb_redirects_on_source", unique: true
124
145
  end
125
146
 
126
147
  end
@@ -1,12 +1,12 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
 
3
3
  sequence :spud_post_title do |n|
4
4
  "Test Blog Post #{n}"
5
5
  end
6
6
 
7
7
  factory :spud_post do
8
- author { FactoryGirl.create(:spud_user) }
9
- title { FactoryGirl.generate(:spud_post_title) }
8
+ author { FactoryBot.create(:spud_user) }
9
+ title { FactoryBot.generate(:spud_post_title) }
10
10
  content 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
11
11
  comments_enabled true
12
12
  visible true
@@ -4,7 +4,7 @@ RSpec.describe Admin::PostsHelper, type: :helper do
4
4
 
5
5
  describe '#link_to_disqus_comment_count' do
6
6
  it 'should return a link with the disqus identifier' do
7
- post = FactoryGirl.create(:spud_post)
7
+ post = FactoryBot.create(:spud_post)
8
8
  result = helper.link_to_disqus_comment_count(post)
9
9
 
10
10
  expect(result).to include("data-disqus-identifier=\"#{post.identifier}\"")
@@ -4,7 +4,7 @@ RSpec.describe BlogHelper, type: :helper do
4
4
 
5
5
  describe '#disqus_comment_count_for_post' do
6
6
  it 'should return a tag with the disqus identifier' do
7
- post = FactoryGirl.create(:spud_post)
7
+ post = FactoryBot.create(:spud_post)
8
8
  result = helper.disqus_comment_count_for_post(post)
9
9
  expect(result).to include("data-disqus-identifier=\"#{post.identifier}\"")
10
10
  end
@@ -4,14 +4,14 @@ RSpec.describe SpudPost, type: :model do
4
4
 
5
5
  describe '#display_date' do
6
6
  it 'should return a date string' do
7
- post = FactoryGirl.create(:spud_post)
7
+ post = FactoryBot.create(:spud_post)
8
8
  expect(post.display_date).to eq(post.published_at.strftime('%b %d, %Y'))
9
9
  end
10
10
  end
11
11
 
12
12
  describe '#set_identifier' do
13
13
  it 'should set a random identifier' do
14
- post = FactoryGirl.create(:spud_post, identifier: nil)
14
+ post = FactoryBot.create(:spud_post, identifier: nil)
15
15
  expect(post.identifier).to be_a(String)
16
16
  end
17
17
  end
data/spec/rails_helper.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
2
  ENV['RAILS_ENV'] ||= 'test'
3
3
 
4
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
+ require File.expand_path('dummy/config/environment.rb', __dir__)
5
5
  require 'spec_helper'
6
6
  require 'rspec/rails'
7
7
  require 'rails-controller-testing'
8
8
  require 'database_cleaner'
9
9
  require 'simplecov'
10
- require 'factory_girl_rails'
10
+ require 'factory_bot_rails'
11
11
  require 'tb_core/test_helper'
12
12
 
13
13
  SimpleCov.start 'rails'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moser Consulting
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-06 00:00:00.000000000 Z
11
+ date: 2018-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: mysql2
70
+ name: database_cleaner
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec-rails
84
+ name: factory_bot_rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rails-controller-testing
98
+ name: mysql2
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: factory_girl_rails
112
+ name: rails-controller-testing
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: database_cleaner
126
+ name: rspec-rails
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: simplecov
140
+ name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rubocop
154
+ name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
@@ -191,12 +191,12 @@ files:
191
191
  - app/helpers/blog/sitemaps_helper.rb
192
192
  - app/helpers/blog_helper.rb
193
193
  - app/helpers/news_helper.rb
194
- - app/models/spud/spud_post_model.rb
195
194
  - app/models/spud_blog_config.rb
196
195
  - app/models/spud_post.rb
197
196
  - app/models/spud_post_categories_post.rb
198
197
  - app/models/spud_post_category.rb
199
198
  - app/models/spud_post_site.rb
199
+ - app/models/tb_core/spud_post_model.rb
200
200
  - app/views/admin/post_categories/_category.html.erb
201
201
  - app/views/admin/post_categories/_form.html.erb
202
202
  - app/views/admin/post_categories/edit.html.erb
@@ -294,6 +294,7 @@ files:
294
294
  - spec/dummy/db/migrate/20161020155450_drop_spud_post_sites.tb_blog.rb
295
295
  - spec/dummy/db/migrate/20161020155451_add_custom_author_to_post.tb_blog.rb
296
296
  - spec/dummy/db/migrate/20161020155452_add_identifier_to_spud_posts.tb_blog.rb
297
+ - spec/dummy/db/migrate/20180730141254_create_active_storage_tables.active_storage.rb
297
298
  - spec/dummy/db/schema.rb
298
299
  - spec/dummy/public/404.html
299
300
  - spec/dummy/public/422.html
@@ -325,73 +326,74 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
326
  version: '0'
326
327
  requirements: []
327
328
  rubyforge_project:
328
- rubygems_version: 2.5.1
329
+ rubygems_version: 2.7.7
329
330
  signing_key:
330
331
  specification_version: 4
331
332
  summary: Twice Baked Blog Engine.
332
333
  test_files:
333
- - spec/authlogic_helper.rb
334
- - spec/controllers/admin/posts_controller_spec.rb
335
- - spec/controllers/posts_controller_spec.rb
334
+ - spec/spec_helper.rb
335
+ - spec/dummy/app/controllers/application_controller.rb
336
+ - spec/dummy/app/views/layouts/application.html.erb
336
337
  - spec/dummy/app/assets/javascripts/application.js
337
338
  - spec/dummy/app/assets/stylesheets/application.css
338
- - spec/dummy/app/controllers/application_controller.rb
339
339
  - spec/dummy/app/helpers/application_helper.rb
340
- - spec/dummy/app/views/layouts/application.html.erb
341
- - spec/dummy/config/application.rb
342
- - spec/dummy/config/boot.rb
343
- - spec/dummy/config/database.yml
344
- - spec/dummy/config/environment.rb
345
- - spec/dummy/config/environments/development.rb
340
+ - spec/dummy/config/routes.rb
341
+ - spec/dummy/config/locales/en.yml
346
342
  - spec/dummy/config/environments/production.rb
343
+ - spec/dummy/config/environments/development.rb
347
344
  - spec/dummy/config/environments/test.rb
345
+ - spec/dummy/config/environment.rb
346
+ - spec/dummy/config/application.rb
347
+ - spec/dummy/config/database.yml
348
+ - spec/dummy/config/boot.rb
348
349
  - spec/dummy/config/initializers/backtrace_silencers.rb
349
- - spec/dummy/config/initializers/inflections.rb
350
350
  - spec/dummy/config/initializers/mime_types.rb
351
- - spec/dummy/config/initializers/secret_token.rb
352
351
  - spec/dummy/config/initializers/session_store.rb
353
352
  - spec/dummy/config/initializers/wrap_parameters.rb
354
- - spec/dummy/config/locales/en.yml
355
- - spec/dummy/config/routes.rb
353
+ - spec/dummy/config/initializers/secret_token.rb
354
+ - spec/dummy/config/initializers/inflections.rb
356
355
  - spec/dummy/config.ru
357
- - spec/dummy/db/migrate/20161020155425_create_spud_admin_permissions.tb_core.rb
358
- - spec/dummy/db/migrate/20161020155426_create_spud_users.tb_core.rb
359
- - spec/dummy/db/migrate/20161020155427_add_time_zone_to_spud_user.tb_core.rb
360
- - spec/dummy/db/migrate/20161020155428_add_scope_to_spud_admin_permissions.tb_core.rb
361
- - spec/dummy/db/migrate/20161020155429_create_spud_user_settings.tb_core.rb
362
- - spec/dummy/db/migrate/20161020155430_create_spud_roles.tb_core.rb
356
+ - spec/dummy/script/rails
357
+ - spec/dummy/Rakefile
358
+ - spec/dummy/public/favicon.ico
359
+ - spec/dummy/public/422.html
360
+ - spec/dummy/public/500.html
361
+ - spec/dummy/public/404.html
362
+ - spec/dummy/db/schema.rb
363
363
  - spec/dummy/db/migrate/20161020155431_create_spud_permissions.tb_core.rb
364
- - spec/dummy/db/migrate/20161020155432_create_spud_role_permissions.tb_core.rb
365
- - spec/dummy/db/migrate/20161020155433_drop_spud_admin_permissions.tb_core.rb
366
- - spec/dummy/db/migrate/20161020155434_add_requires_password_change_to_spud_users.tb_core.rb
367
364
  - spec/dummy/db/migrate/20161020155435_create_tb_redirects.tb_redirects.rb
365
+ - spec/dummy/db/migrate/20161020155425_create_spud_admin_permissions.tb_core.rb
366
+ - spec/dummy/db/migrate/20161020155442_add_meta_to_posts.tb_blog.rb
367
+ - spec/dummy/db/migrate/20161020155428_add_scope_to_spud_admin_permissions.tb_core.rb
368
368
  - spec/dummy/db/migrate/20161020155437_create_spud_posts.tb_blog.rb
369
369
  - spec/dummy/db/migrate/20161020155438_create_spud_post_categories.tb_blog.rb
370
- - spec/dummy/db/migrate/20161020155439_add_url_to_spud_posts.tb_blog.rb
371
- - spec/dummy/db/migrate/20161020155440_add_url_to_spud_post_categories.tb_blog.rb
372
- - spec/dummy/db/migrate/20161020155441_add_is_news_to_spud_posts.tb_blog.rb
373
- - spec/dummy/db/migrate/20161020155442_add_meta_to_posts.tb_blog.rb
374
- - spec/dummy/db/migrate/20161020155443_create_spud_post_sites.tb_blog.rb
375
- - spec/dummy/db/migrate/20161020155444_add_nested_set_to_post_categories.tb_blog.rb
376
370
  - spec/dummy/db/migrate/20161020155445_add_content_format_to_spud_posts.tb_blog.rb
377
- - spec/dummy/db/migrate/20161020155446_add_content_processed_to_spud_post.tb_blog.rb
378
- - spec/dummy/db/migrate/20161020155447_add_primary_key_to_spud_post_categories_posts.tb_blog.rb
379
- - spec/dummy/db/migrate/20161020155448_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb
371
+ - spec/dummy/db/migrate/20180730141254_create_active_storage_tables.active_storage.rb
372
+ - spec/dummy/db/migrate/20161020155433_drop_spud_admin_permissions.tb_core.rb
380
373
  - spec/dummy/db/migrate/20161020155449_add_blog_key_to_spud_posts.tb_blog.rb
374
+ - spec/dummy/db/migrate/20161020155432_create_spud_role_permissions.tb_core.rb
381
375
  - spec/dummy/db/migrate/20161020155450_drop_spud_post_sites.tb_blog.rb
376
+ - spec/dummy/db/migrate/20161020155427_add_time_zone_to_spud_user.tb_core.rb
377
+ - spec/dummy/db/migrate/20161020155429_create_spud_user_settings.tb_core.rb
382
378
  - spec/dummy/db/migrate/20161020155451_add_custom_author_to_post.tb_blog.rb
379
+ - spec/dummy/db/migrate/20161020155440_add_url_to_spud_post_categories.tb_blog.rb
380
+ - spec/dummy/db/migrate/20161020155426_create_spud_users.tb_core.rb
381
+ - spec/dummy/db/migrate/20161020155444_add_nested_set_to_post_categories.tb_blog.rb
382
+ - spec/dummy/db/migrate/20161020155439_add_url_to_spud_posts.tb_blog.rb
383
+ - spec/dummy/db/migrate/20161020155448_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb
384
+ - spec/dummy/db/migrate/20161020155443_create_spud_post_sites.tb_blog.rb
385
+ - spec/dummy/db/migrate/20161020155430_create_spud_roles.tb_core.rb
386
+ - spec/dummy/db/migrate/20161020155447_add_primary_key_to_spud_post_categories_posts.tb_blog.rb
387
+ - spec/dummy/db/migrate/20161020155441_add_is_news_to_spud_posts.tb_blog.rb
383
388
  - spec/dummy/db/migrate/20161020155452_add_identifier_to_spud_posts.tb_blog.rb
384
- - spec/dummy/db/schema.rb
385
- - spec/dummy/public/404.html
386
- - spec/dummy/public/422.html
387
- - spec/dummy/public/500.html
388
- - spec/dummy/public/favicon.ico
389
- - spec/dummy/Rakefile
389
+ - spec/dummy/db/migrate/20161020155446_add_content_processed_to_spud_post.tb_blog.rb
390
+ - spec/dummy/db/migrate/20161020155434_add_requires_password_change_to_spud_users.tb_core.rb
390
391
  - spec/dummy/README.rdoc
391
- - spec/dummy/script/rails
392
+ - spec/models/spud_post_spec.rb
392
393
  - spec/factories/spud_post_factories.rb
394
+ - spec/controllers/posts_controller_spec.rb
395
+ - spec/controllers/admin/posts_controller_spec.rb
396
+ - spec/rails_helper.rb
393
397
  - spec/helpers/admin/posts_helper_spec.rb
394
398
  - spec/helpers/blog_helper_spec.rb
395
- - spec/models/spud_post_spec.rb
396
- - spec/rails_helper.rb
397
- - spec/spec_helper.rb
399
+ - spec/authlogic_helper.rb