Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Update Test Suite
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger committed Dec 31, 2021
1 parent d976f8b commit 368123b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ jobs:
matrix:
include:
### TEST ALL RUBY VERSIONS, USE DEFAULT GEMFILE
- ruby: 2.3
- ruby: 2.3 ### min version supported by Bundler 2.x
- ruby: 2.4
- ruby: 2.5
- ruby: 2.6
- ruby: 2.7
- ruby: 3.0
- ruby: "3.0" ### must be quoted otherwise will be treated as "3" which will resolve to latest 3.x version
- ruby: 3.1

### RAILS VERSION TESTING
- ruby: 2.6
Expand All @@ -31,7 +32,7 @@ jobs:
gemfile: gemfiles/rails_6.0.sqlite3.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_6.1.sqlite3.gemfile
- ruby: 3.0
- ruby: "3.0"
gemfile: gemfiles/rails_7.0.sqlite3.gemfile

env:
Expand All @@ -47,12 +48,11 @@ jobs:

- name: Bundle
run: |
gem install bundler:1.17.3
bundle _1.17.3_ install
gem install bundler
bundle install
- name: Run tests
run: |
#bundle exec rake db:test:prepare
bundle exec rake
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
gemfile: gemfiles/rails_6.0.mysql2.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_6.1.mysql2.gemfile
- ruby: 3.0
- ruby: "3.0"
gemfile: gemfiles/rails_7.0.mysql2.gemfile

env:
Expand All @@ -98,15 +98,14 @@ jobs:

- name: Bundle
run: |
gem install bundler:1.17.3
bundle _1.17.3_ install
gem install bundler
bundle install
- name: Run tests
env:
DATABASE_URL: mysql2://root:[email protected]:3306/test
RAILS_ENV: test
run: |
#bundle exec rake db:test:prepare
bundle exec rake
Expand Down Expand Up @@ -137,7 +136,7 @@ jobs:
gemfile: gemfiles/rails_6.0.pg.gemfile
- ruby: 2.6
gemfile: gemfiles/rails_6.1.pg.gemfile
- ruby: 3.0
- ruby: "3.0"
gemfile: gemfiles/rails_7.0.pg.gemfile

env:
Expand All @@ -153,13 +152,12 @@ jobs:

- name: Bundle
run: |
gem install bundler:1.17.3
bundle _1.17.3_ install
gem install bundler
bundle install
- name: Run tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
run: |
#bundle exec rails db:test:prepare
bundle exec rake
7 changes: 5 additions & 2 deletions test/attribute_sanitization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,13 @@ def test_create_with_bang_with_without_protection_with_attr_protected_attributes

def test_protection_against_class_attribute_writers
attribute_writers = [:logger, :configurations, :primary_key_prefix_type, :table_name_prefix, :table_name_suffix, :pluralize_table_names,
:default_timezone, :schema_format, :lock_optimistically, :timestamped_migrations, :default_scopes,
:connection_handler, :nested_attributes_options,
:lock_optimistically, :default_scopes, :connection_handler, :nested_attributes_options,
:attribute_method_matchers, :time_zone_aware_attributes, :skip_time_zone_conversion_for_attributes]

if Rails::VERSION::MAJOR <= 6
attribute_writers += [:default_timezone, :schema_format, :timestamped_migrations]
end

attribute_writers.push(:_attr_readonly) if ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 0

attribute_writers.each do |method|
Expand Down

0 comments on commit 368123b

Please sign in to comment.