Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update test suite config #43

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--require rails_helper
--format documentation
2 changes: 0 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ end
appraise 'rails70-activeadmin' do
gem 'activeadmin'
gem 'rails', '~> 7.0.0'
gem 'sprockets-rails'
end

appraise 'rails71-activeadmin' do
gem 'activeadmin'
gem 'rails', '~> 7.1.0'
gem 'sprockets-rails'
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gemspec
group :development, :test do
gem 'puma'
gem 'sassc'
gem 'sprockets-rails'
gem 'sqlite3'

# Testing
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails61_activeadmin.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gem "rails", "~> 6.1.0"
group :development, :test do
gem "puma"
gem "sassc"
gem "sprockets-rails"
gem "sqlite3"
gem "capybara"
gem "cuprite"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails61_activeadmin.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ DEPENDENCIES
rubocop-rails
rubocop-rspec
sassc
sprockets-rails
sqlite3

BUNDLED WITH
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails61_activeadmin29.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gem "rails", "~> 6.1.0"
group :development, :test do
gem "puma"
gem "sassc"
gem "sprockets-rails"
gem "sqlite3"
gem "capybara"
gem "cuprite"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails61_activeadmin29.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ DEPENDENCIES
rubocop-rails
rubocop-rspec
sassc
sprockets-rails
sqlite3

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails70_activeadmin.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ source "https://rubygems.org"

gem "activeadmin"
gem "rails", "~> 7.0.0"
gem "sprockets-rails"

group :development, :test do
gem "puma"
gem "sassc"
gem "sprockets-rails"
gem "sqlite3"
gem "capybara"
gem "cuprite"
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails71_activeadmin.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ source "https://rubygems.org"

gem "activeadmin"
gem "rails", "~> 7.1.0"
gem "sprockets-rails"

group :development, :test do
gem "puma"
gem "sassc"
gem "sprockets-rails"
gem "sqlite3"
gem "capybara"
gem "cuprite"
Expand Down
1 change: 0 additions & 1 deletion spec/dummy/.ruby-version

This file was deleted.

1 change: 0 additions & 1 deletion spec/dummy/.tool-versions

This file was deleted.

5 changes: 5 additions & 0 deletions spec/dummy/app/admin/profiles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

ActiveAdmin.register Profile do
permit_params :author_id, :description
end
6 changes: 4 additions & 2 deletions spec/dummy/app/models/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def to_s
"#{name} (#{age})"
end

def self.ransackable_attributes(auth_object = nil)
%w[age created_at email id name updated_at]
class << self
def ransackable_attributes(_auth_object = nil)
%w[age created_at email id name updated_at]
end
end
end
14 changes: 8 additions & 6 deletions spec/dummy/app/models/post.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Post < ApplicationRecord
enum state: %i[available unavailable arriving]
# enum state: %i[available unavailable arriving]

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

Expand All @@ -27,11 +27,13 @@ def upper_title
title.upcase
end

def self.ransackable_attributes(auth_object = nil)
%w[author_id category created_at description dt id position published summary title updated_at]
end
class << self
def ransackable_attributes(auth_object = nil)
%w[author_id category created_at description dt id position published summary title updated_at]
end

def self.ransackable_associations(auth_object = nil)
%w[author author_profile images_attachments images_blobs post_tags tags]
def ransackable_associations(auth_object = nil)
%w[author author_profile images_attachments images_blobs post_tags tags]
end
end
end
6 changes: 4 additions & 2 deletions spec/dummy/app/models/post_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class PostTag < ApplicationRecord
validates :post, presence: true
validates :tag, presence: true

def self.ransackable_attributes(auth_object = nil)
%w[created_at id post_id tag_id updated_at]
class << self
def ransackable_attributes(auth_object = nil)
%w[created_at id post_id tag_id updated_at]
end
end
end
18 changes: 13 additions & 5 deletions spec/dummy/app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
class Profile < ApplicationRecord
belongs_to :author, inverse_of: :profile, touch: true

def to_s
description
end
# has_rich_text :description

# def to_s
# description
# end

class << self
def ransackable_associations(auth_object = nil)
%w[author]
end

def self.ransackable_attributes(auth_object = nil)
%w[author_id created_at description id updated_at]
def ransackable_attributes(_auth_object = nil)
%w[author_id created_at description id updated_at]
end
end
end
10 changes: 10 additions & 0 deletions spec/dummy/app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@
class Tag < ApplicationRecord
has_many :post_tags, inverse_of: :tag, dependent: :destroy
has_many :posts, through: :post_tags

class << self
def ransackable_associations(auth_object = nil)
%w[post_tags posts]
end

def ransackable_attributes(auth_object = nil)
%w[created_at id id_value name updated_at]
end
end
end
6 changes: 5 additions & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Application < Rails::Application

###

config.active_record.legacy_connection_handling = false if Rails::VERSION::MAJOR > 6
config.active_record.legacy_connection_handling = false if Gem::Version.new(Rails.version) < Gem::Version.new('7.1')

config.before_configuration do
ActiveSupport::Cache.format_version = 7.0 if Gem::Version.new(Rails.version) > Gem::Version.new('7.0')
end
end
end
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
end

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# config.active_storage.service = :local

# # Don't care if the mailer can't send.
# config.action_mailer.raise_delivery_errors = false
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
config.cache_store = :null_store

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
config.action_dispatch.show_exceptions = :none

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
Expand Down
3 changes: 1 addition & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }

# Force deprecations to raise an exception.
ActiveSupport::Deprecation.behavior = :raise
# ActiveSupport::Deprecation.behavior = :raise

# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
Expand All @@ -27,7 +27,6 @@
end

RSpec.configure do |config|
config.fixture_path = Rails.root.join('spec/fixtures').to_s
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!

Expand Down
Loading