Skip to content

Commit d6df553

Browse files
committed
test: Update outdated test suite options
1 parent 75efd07 commit d6df553

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

spec/dummy/app/admin/posts.rb

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
ActiveAdmin.register Post do
44
permit_params :author_id, :title, :description, :category, :dt, :position, :published, tag_ids: []
55

6+
remove_filter :state
7+
68
member_action :save, method: [:post] do
79
render ActiveAdmin::DynamicFields.update(resource, params)
810
end

spec/dummy/app/models/post.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# frozen_string_literal: true
22

33
class Post < ApplicationRecord
4-
enum state: %i[available unavailable arriving]
4+
if Gem::Version.new(Rails.version) >= Gem::Version.new('8.0')
5+
enum :state, %i[available unavailable arriving]
6+
else
7+
enum state: %i[available unavailable arriving]
8+
end
59

610
belongs_to :author, inverse_of: :posts, autosave: true
711

@@ -10,7 +14,7 @@ class Post < ApplicationRecord
1014
has_many :post_tags, inverse_of: :post, dependent: :destroy
1115
has_many :tags, through: :post_tags
1216

13-
serialize :description, JSON
17+
serialize :description, coder: JSON
1418

1519
after_initialize -> { self.description = {} if description.nil? }
1620

spec/dummy/db/migrate/20180607053739_create_posts.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class CreatePosts < ActiveRecord::Migration[5.2]
44
def change
55
create_table :posts do |t|
66
t.string :title
7+
t.string :state
78
t.text :description
89
t.belongs_to :author, foreign_key: true
910
t.string :category

spec/dummy/db/schema.rb

+19-19
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2018_06_07_053739) do
14-
13+
ActiveRecord::Schema[7.0].define(version: 2018_06_07_053739) do
1514
create_table "active_admin_comments", force: :cascade do |t|
1615
t.string "namespace"
1716
t.text "body"
1817
t.string "resource_type"
19-
t.bigint "resource_id"
18+
t.integer "resource_id"
2019
t.string "author_type"
21-
t.bigint "author_id"
22-
t.datetime "created_at", precision: 6, null: false
23-
t.datetime "updated_at", precision: 6, null: false
20+
t.integer "author_id"
21+
t.datetime "created_at", null: false
22+
t.datetime "updated_at", null: false
2423
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
2524
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
2625
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
@@ -31,7 +30,7 @@
3130
t.string "record_type", null: false
3231
t.integer "record_id", null: false
3332
t.integer "blob_id", null: false
34-
t.datetime "created_at", null: false
33+
t.datetime "created_at", precision: nil, null: false
3534
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
3635
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
3736
end
@@ -43,52 +42,53 @@
4342
t.text "metadata"
4443
t.bigint "byte_size", null: false
4544
t.string "checksum", null: false
46-
t.datetime "created_at", null: false
45+
t.datetime "created_at", precision: nil, null: false
4746
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
4847
end
4948

5049
create_table "authors", force: :cascade do |t|
5150
t.string "name"
5251
t.integer "age"
5352
t.string "email"
54-
t.datetime "created_at", null: false
55-
t.datetime "updated_at", null: false
53+
t.datetime "created_at", precision: nil, null: false
54+
t.datetime "updated_at", precision: nil, null: false
5655
end
5756

5857
create_table "post_tags", force: :cascade do |t|
5958
t.integer "post_id"
6059
t.integer "tag_id"
61-
t.datetime "created_at", null: false
62-
t.datetime "updated_at", null: false
60+
t.datetime "created_at", precision: nil, null: false
61+
t.datetime "updated_at", precision: nil, null: false
6362
t.index ["post_id"], name: "index_post_tags_on_post_id"
6463
t.index ["tag_id"], name: "index_post_tags_on_tag_id"
6564
end
6665

6766
create_table "posts", force: :cascade do |t|
6867
t.string "title"
68+
t.string "state"
6969
t.text "description"
7070
t.integer "author_id"
7171
t.string "category"
72-
t.datetime "dt"
72+
t.datetime "dt", precision: nil
7373
t.float "position"
7474
t.boolean "published"
75-
t.datetime "created_at", null: false
76-
t.datetime "updated_at", null: false
75+
t.datetime "created_at", precision: nil, null: false
76+
t.datetime "updated_at", precision: nil, null: false
7777
t.index ["author_id"], name: "index_posts_on_author_id"
7878
end
7979

8080
create_table "profiles", force: :cascade do |t|
8181
t.text "description"
8282
t.integer "author_id"
83-
t.datetime "created_at", null: false
84-
t.datetime "updated_at", null: false
83+
t.datetime "created_at", precision: nil, null: false
84+
t.datetime "updated_at", precision: nil, null: false
8585
t.index ["author_id"], name: "index_profiles_on_author_id"
8686
end
8787

8888
create_table "tags", force: :cascade do |t|
8989
t.string "name"
90-
t.datetime "created_at", null: false
91-
t.datetime "updated_at", null: false
90+
t.datetime "created_at", precision: nil, null: false
91+
t.datetime "updated_at", precision: nil, null: false
9292
end
9393

9494
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"

0 commit comments

Comments
 (0)