Skip to content

Commit 1cbdfde

Browse files
committed
test: Update outdated test suite options (2)
1 parent 3f11052 commit 1cbdfde

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

spec/dummy/app/admin/tags.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
22

33
ActiveAdmin.register Tag do
4+
permit_params :name
45
end

spec/dummy/app/models/post.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ class Post < ApplicationRecord
1414
has_many :post_tags, inverse_of: :post, dependent: :destroy
1515
has_many :tags, through: :post_tags
1616

17-
serialize :description, coder: JSON
17+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
18+
serialize :description, coder: JSON
19+
else
20+
serialize :description, JSON
21+
end
1822

1923
after_initialize -> { self.description = {} if description.nil? }
2024

@@ -50,13 +54,11 @@ def upper_title
5054
title.upcase
5155
end
5256

53-
class << self
54-
def ransackable_associations(_auth_object = nil)
55-
["author", "author_profile", "post_tags", "tags"]
56-
end
57+
def self.ransackable_associations(_auth_object = nil)
58+
["author", "author_profile", "post_tags", "tags"]
59+
end
5760

58-
def ransackable_attributes(_auth_object = nil)
59-
["author_id", "category", "created_at", "description", "dt", "id", "position", "published", "title", "updated_at"]
60-
end
61+
def self.ransackable_attributes(_auth_object = nil)
62+
["author_id", "category", "created_at", "description", "dt", "id", "position", "published", "title", "updated_at"]
6163
end
6264
end

spec/dummy/app/models/tag.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@
33
class Tag < ApplicationRecord
44
has_many :post_tags, inverse_of: :tag, dependent: :destroy
55
has_many :posts, through: :post_tags
6+
7+
def self.ransackable_associations(auth_object = nil)
8+
["post_tags", "posts"]
9+
end
10+
11+
def self.ransackable_attributes(auth_object = nil)
12+
["created_at", "id", "name", "updated_at"]
13+
end
614
end

spec/rails_helper.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
end
2727

2828
RSpec.configure do |config|
29-
config.fixture_path = Rails.root.join('spec/fixtures')
29+
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
30+
config.fixture_paths = [Rails.root.join('spec/fixtures')]
31+
else
32+
config.fixture_path = Rails.root.join('spec/fixtures')
33+
end
34+
3035
config.infer_spec_type_from_file_location!
3136
config.filter_rails_from_backtrace!
3237

spec/support/capybara.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
Capybara::Cuprite::Driver.new(
1111
app,
12-
window_size: [1600, 1280],
12+
window_size: [1600, 1024],
1313
browser_options: browser_options,
14-
process_timeout: 20,
15-
timeout: 20,
14+
process_timeout: 30,
15+
timeout: 30,
1616
inspector: true,
1717
headless: !ENV['CUPRITE_HEADLESS'].in?(%w[n 0 no false])
1818
)

0 commit comments

Comments
 (0)