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

Update license year #1532

Closed
wants to merge 35 commits into from
Closed

Update license year #1532

wants to merge 35 commits into from

Conversation

vsppedro
Copy link
Collaborator

@vsppedro vsppedro commented Jan 1, 2023

TODO

leoarnold and others added 30 commits October 11, 2021 18:08
Prior to this commit, the `Gemfile.lock` enforced the use of
Bundler v1.17.3 which was released in 2014.

On Ruby 3, this triggers the following deprecation warning:

```
/home/user/.rvm/gems/ruby-3.0.2@shoulda-matchers/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:118: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
```

Since the gem itself in v5.0.0 requires at least Ruby v2.6,
it seems fair to require a recent version of Bundler v2,
which in turn runs of every Ruby v2.3 or later.
* Added array option support for have_db_column matcher

* Added specs for array option support for have_db_column matcher

* Emtty commit
* Update Ruby Version

* Bump Bootsnap version to 1.9.3
* Update references to `master` on documentation

The master branch has been renamed to main, but the docs
still reference it as master.

* Update the changelog URI

The changelog URI should be pointed to the main branch, where it is
updated. The master branch is archived and has not been updated since
version 5.0.0.

* Update the main branch on Github Actions config

Since shoulda-matchers 5.1.0, the main branch of the repository
is `main`.
- Change links from Travis CI to GitHub Actions
- Add an explanation about first-time contributors needing approval
With Apple moving to M1, homebrew took the opportunity to change the
install location from /usr/local to /opt/homebrew

So check for /opt/homebrew in addition to /usr/local for a chruby.sh
* Update sqlite3 to a version that works on M1

* Always use SQLite ~> 1.4

Rails 5.2 changed at some point to not specify a version. < 1.4 of
sqlite fails to build on Apple M1s.
* Don't explicitly add action_text, as it's a dependency of rails. Check rails version to see if it should be installed

* Increase rails 6.0 and 6.1 to latest patchest version

* Fix rails version check
Rails 6 added the `_scopes: false` option when defining enums. This will
prevent rails from creating class scopes for each of the values.

Previously, shoulda-matchers checked for the presence of singleton
methods as a way to check that the corresponding enum methods have been
defined. In rails 6, if someone were using `_scopes: false` the matcher
will fail.

Instead, we should check on the presence of the instance methods that
are generated: `#{value}!` and `#{value}?` as the default checker for
the enum values generating methods.

We can then check on the scopes/singleton methods generated when using
the new `without_scopes` matcher.
* Skip bootsnap on the test project creation

Use the Rails --skip-bootsnap option instead of commenting it on
boot.rb

* Use the same `rails new` command on acceptance and unit tests

* Fix the Rails version comparison

The `=~ '~> 6.0'` comparison is evaluated to `false` on newer
versions of Rails, thus not skipping the JavaScript dependencies.
* Update ruby to the latest version

* Bump Rubocop to 1.36.0

* Fix "Style/RedundantBegin: Redundant begin block detected" rubocop offense

* Disable Naming/VariableNumber offense

* Fix "Style/RedundantParentheses: Don't use parentheses around a literal" rubocop offense

* Fix "Lint/RedundantCopDisableDirective: Unnecessary disabling of Style/FormatStringToken." rubocop offense

* Fix "Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call" rubocop offense

* Bump Ruby to 3.1.2

* Bump rubocop-rails to 2.16.1

* Bump rubocop-packaging to 0.5.2
* Bump Rails from 5.2.6 to 5.2.8.1

* Bump Rails from 6.0.4.4 to 6.0.6

* Bump Rails from 6.1.4.4 to 6.1.7

* test: skip validates_presence_of test with has_secure_password when rails greater than 6.0

See: rails/rails#43378

* Bump Rails from 7.0.1 to 7.0.4
Closes: #1493

In Rails 7 was added a new option to validate numericality. You can use
`in: range` to specify a range to validate an attribute.

```ruby
class User < ApplicationRecord
  validates :age, numericality: { greater_than_or_equal_to: 18, less_than_or_equal_to: 65 }
end

class User < ApplicationRecord
  validates :age, numericality: { in: 18..65 }
end
```

In this commit we are adding the support matcher to this new
functionality, while also making a refactor on the numericality
matchers that use the concept of submatchers.

We've created a new class (`NumericalityMatchers::Submatcher`) that's
been used by `NumericalityMatchers::RangeMatcher` and
`NumericalityMatchers::ComparisonMatcher`, this new class wil handle
shared logic regarding having submatchers that will check if the parent
matcher is valid or not.

Our new class `Numericality::Matchers::RangeMatcher` is using as
submatchers two `NumericalityMatchers::ComparisonMatcher` instances to
avoid creating new logic to handle this new option and also to replicate
what was being used before this option existed in Rails (see example
above)

In this commit we are adding:

* NumericalityMatchers::RangeMatcher file to support the new `in: range`
  option.
* Specs on ValidateNumericalityOfMatcherSpec file for the new supported
  option, only running on rails_versions > 7.
* NumericalityMatchers::Submatchers file to handle having submatchers
  inside a matcher file.
* Refactors to NumericalityMatchers::ComparisonMatcher.
dlupu and others added 5 commits November 14, 2022 16:17
* Update validate_absence_of_matcher.rb

* Update validate_absence_of_matcher_spec.rb

* Update validate_absence_of_matcher.rb

Remove trailing whitespace

* Update spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb
@vsppedro vsppedro closed this Jan 1, 2023
@vsppedro vsppedro deleted the update-license-year branch January 1, 2023 16:02
@vsppedro vsppedro restored the update-license-year branch January 1, 2023 16:04
@vsppedro vsppedro deleted the update-license-year branch January 1, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet