Skip to content

Commit

Permalink
Merge branch 'thoughtbot:main' into feature/removing-array-column-hel…
Browse files Browse the repository at this point in the history
…per-from-validate-absence-of-matcher
  • Loading branch information
jarenas9539 authored Dec 24, 2023
2 parents 1f5001d + a373661 commit fef79d2
Show file tree
Hide file tree
Showing 62 changed files with 2,103 additions and 1,189 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

<!-- By contributing to this project, you agree to abide by the thoughtbot Code
of Conduct: https://thoughtbot.com/open-source-code-of-conduct -->

### Description

<!-- A clear and concise description of what the bug is. -->

### Reproduction Steps

<!-- Steps for others to reproduce the bug. Be as specific as possible. A
reproduction script or link to a sample application that demonstrates the
problem are especially helpful. -->

<!-- You can create a reproduction script by copying this sample reproduction
script and adding whatever code is necessary to get a failing test case:
https://github.com/thoughtbot/shoulda-matchers/blob/main/.github/REPRODUCTION_SCRIPT.rb -->

### Expected behavior

<!-- What you expected to happen. -->

### Actual behavior

<!-- What happened instead. -->

### System configuration
**shoulda_matchers version**:
**rails version**:
**ruby version**:
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

<!-- By contributing to this project, you agree to abide by the thoughtbot Code
of Conduct: https://thoughtbot.com/open-source-code-of-conduct -->

### Problem this feature will solve

<!-- A clear and concise description of what the problem is. Ex. When doing
[...] I find it difficult to [...] -->

### Desired solution

<!-- The feature or change that would solve the problem -->

## Alternatives considered

<!-- Any alternative solutions or features you've considered. -->

## Additional context

<!-- Add any other context about this feature request. -->
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ jobs:
fail-fast: false
matrix:
ruby:
- 3.3.0-rc1
- 3.2.2
- 3.1.4
- 3.0.6
appraisal:
- rails_7_1
- rails_7_0
- rails_6_1
adapter:
- sqlite3
- postgresql
exclude:
- { ruby: 3.3.0-rc1, appraisal: rails_6_1 }
- { ruby: 3.3.0-rc1, appraisal: rails_7_0 }
- { ruby: 3.2.2, appraisal: rails_6_1 }
- { ruby: 3.1.4, appraisal: rails_5_2 }
- { ruby: 3.0.6, appraisal: rails_5_2 }
- { ruby: 3.0.6, appraisal: rails_7_0 }
- { ruby: 3.0.6, appraisal: rails_7_1 }
env:
DATABASE_ADAPTER: ${{ matrix.adapter }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AllCops:
TargetRubyVersion: 3.0
Exclude:
- 'gemfiles/*'
- 'REPRODUCTION_SCRIPT.rb'
Bundler/OrderedGems:
Include:
- '**/Gemfile'
Expand Down
32 changes: 30 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ appraise 'rails_6_1' do
instance_eval(&shared_spring_dependencies)
instance_eval(&controller_test_dependency)

gem 'rails', '6.1.7.2'
gem 'rails', '6.1.7.6'
gem 'puma', '~> 5.0'
gem 'sass-rails', '>= 6'
gem 'turbolinks', '~> 5'
Expand Down Expand Up @@ -45,7 +45,7 @@ appraise 'rails_7_0' do
instance_eval(&shared_spring_dependencies)
instance_eval(&controller_test_dependency)

gem 'rails', '7.0.4.2'
gem 'rails', '7.0.8'
gem 'sprockets-rails'
gem 'puma', '~> 5.0'
gem 'importmap-rails'
Expand All @@ -68,3 +68,31 @@ appraise 'rails_7_0' do
gem 'sqlite3', '~> 1.4'
gem 'pg', '~> 1.1'
end

appraise 'rails_7_1' do
instance_eval(&shared_spring_dependencies)
instance_eval(&controller_test_dependency)

gem 'rails', '7.1.2'
gem 'sprockets-rails'
gem 'puma', '~> 6.0'
gem 'importmap-rails'
gem 'turbo-rails'
gem 'stimulus-rails'
gem 'jbuilder'
gem 'bootsnap', require: false
gem 'capybara'
gem 'selenium-webdriver'
gem 'webdrivers'

# test dependencies
gem 'rspec-rails', '~> 6.0'
gem 'shoulda-context', '~> 2.0.0'

# other dependencies
gem 'bcrypt', '~> 3.1.7'

# Database adapters
gem 'sqlite3', '~> 1.4'
gem 'pg', '~> 1.1'
end
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Changelog

## 6.0.0 - 2023-12-22

### Backward-incompatible changes

* Drop support for Rails 5.2 and 6.0 as well as Ruby 2.6 and 2.7 they've been end-of-lifed by @dougmrqs and @HeitorMC.
The gem now supports Ruby 3.0+ and Rails 6.1+. ([#1521], [#1522], [#1547], [#1548])

[#1521]: https://github.com/thoughtbot/shoulda-matchers/pull/1521
[#1522]: https://github.com/thoughtbot/shoulda-matchers/pull/1522
[#1547]: https://github.com/thoughtbot/shoulda-matchers/pull/1547
[#1548]: https://github.com/thoughtbot/shoulda-matchers/pull/1548

### Bug fixes

* Fix validate_uniqueness_of matcher not supporting column of the type timestampz by @callahat. ([#1544])
* Ensure that validation specs work for ActiveModel without ActiveRecord by @stonefield. ([#1580])

[#1544]: https://github.com/thoughtbot/shoulda-matchers/pull/1544
[#1580]: https://github.com/thoughtbot/shoulda-matchers/pull/1580

### Features
* Add normalize matcher by @stephannv. ([#1558])
* Add validates_comparison_of matcher by @matsales28. ([#1552])
* Add support for Ruby 3.2 by @petergoldstein. ([#1536])
* Add support for Ruby 3.3.0-rc1 by @mtasaka and @VSPPedro. ([#1579], [#1588])
* Add support for Rails 7.1 by @matsales28. ([#1573])
* Add support for array attributes on validate_length_of matcher by @jarenas9539. [#1560]
* Allow length validation on associations by @matsales28. ([#1569])
* Improve have_db_index to better handle columns with multiple indexes by @abrom. ([#1542])
* Implement of_sql_type qualifier on have_db_column matcher by @matsales28. ([#1555])

[#1536]: https://github.com/thoughtbot/shoulda-matchers/pull/1536
[#1542]: https://github.com/thoughtbot/shoulda-matchers/pull/1542
[#1552]: https://github.com/thoughtbot/shoulda-matchers/pull/1552
[#1555]: https://github.com/thoughtbot/shoulda-matchers/pull/1555
[#1558]: https://github.com/thoughtbot/shoulda-matchers/pull/1558
[#1560]: https://github.com/thoughtbot/shoulda-matchers/pull/1560
[#1569]: https://github.com/thoughtbot/shoulda-matchers/pull/1569
[#1573]: https://github.com/thoughtbot/shoulda-matchers/pull/1573
[#1578]: https://github.com/thoughtbot/shoulda-matchers/pull/1578
[#1588]: https://github.com/thoughtbot/shoulda-matchers/pull/1588


### Improvements

* When an unrelated error is seen with negated allow_value, give a hint by @matsales28. ([#1570])

[#1570]: https://github.com/thoughtbot/shoulda-matchers/pull/1570

## 5.3.0 - 2022-12-16

### Features
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# This should make it easy to add new rules without breaking existing ones.

# Global rule:
* @mcmire @guialbuk @VSPPedro
* @VSPPedro @matsales28
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'appraisal', '2.4.0'
gem 'appraisal', '2.5.0'
gem 'bundler', '~> 2.0'
gem 'pry'
gem 'pry-byebug'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GEM
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
appraisal (2.4.0)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
Expand Down Expand Up @@ -82,7 +82,7 @@ PLATFORMS
ruby

DEPENDENCIES
appraisal (= 2.4.0)
appraisal (= 2.5.0)
bundler (~> 2.0)
fssm
pry
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2006-2023 Tammer Saleh and thoughtbot, inc.
Copyright (c) Tammer Saleh and thoughtbot, inc.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Start by including `shoulda-matchers` in your Gemfile:

```ruby
group :test do
gem 'shoulda-matchers', '~> 5.0'
gem 'shoulda-matchers', '~> 6.0'
end
```

Expand Down Expand Up @@ -117,7 +117,7 @@ Otherwise, add `shoulda-matchers` to your Gemfile:

```ruby
group :test do
gem 'shoulda-matchers', '~> 5.0'
gem 'shoulda-matchers', '~> 6.0'
end
```

Expand Down Expand Up @@ -409,6 +409,8 @@ about any of them, make sure to [consult the documentation][rubydocs]!
usage of the `serialize` macro.
* **[validate_uniqueness_of](lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb)**
tests usage of `validates_uniqueness_of`.
* **[normalize](lib/shoulda/matchers/active_record/normalize_matcher.rb)** tests
usage of the `normalize` macro

### ActionController matchers

Expand Down Expand Up @@ -486,16 +488,26 @@ Shoulda Matchers follows Semantic Versioning 2.0 as defined at

## Team

Shoulda Matchers is maintained by [Elliot Winkler][mcmire], [Gui
Albuk][guialbuk] and [Pedro Paiva][VSPPedro].
Shoulda Matchers is currently maintained by [Pedro Paiva][VSPPedro] and [Matheus
Sales][matsales28]. Previous maintainers include [Elliot Winkler][mcmire],
[Gui Albuk][guialbuk], [Jason Draper][drapergeek], [Melissa Xie][mxie],
[Gabe Berke-Williams][gabebw], [Ryan McGeary][rmm5t], [Joe Ferris][jferris], and
[Tammer Saleh][tammersaleh].

[VSPPedro]: https://github.com/VSPPedro
[matsales28]: https://github.com/matsales28
[mcmire]: https://github.com/mcmire
[guialbuk]: https://github.com/guialbuk
[VSPPedro]: https://github.com/VSPPedro
[drapergeek]: https://github.com/drapergeek
[mxie]: https://github.com/mxie
[gabebw]: https://github.com/gabebw
[rmm5t]: https://github.com/rmm5t
[jferris]: https://github.com/jferris
[tammersaleh]: https://github.com/tammersaleh

## Copyright/License

Shoulda Matchers is copyright © 2006-2023 Tammer Saleh and [thoughtbot,
Shoulda Matchers is copyright © Tammer Saleh and [thoughtbot,
inc][thoughtbot-website]. It is free and opensource software and may be
redistributed under the terms specified in the [LICENSE](LICENSE) file.

Expand Down
52 changes: 52 additions & 0 deletions REPRODUCTION_SCRIPT.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
require 'bundler/inline'

gemfile(true) do
source 'https://rubygems.org'
gem 'shoulda-matchers'
gem 'activerecord'
gem 'sqlite3'
gem 'rspec'
end

require 'active_record'
require 'shoulda-matchers'
require 'logger'

ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)

# TODO: Update the schema to include the specific tables or columns necessary
# to reproduct the bug
ActiveRecord::Schema.define do
create_table :posts, force: true do |t|
t.string :body
end
end

Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec

with.library :active_record
with.library :active_model
end
end

RSpec.configure do |config|
config.include Shoulda::Matchers::ActiveRecord
config.include Shoulda::Matchers::ActiveModel
config.include Shoulda::Matchers::ActionController
end

# TODO: Add any application specific code necessary to reproduce the bug
class Post < ActiveRecord::Base
validates :body, uniqueness: true
end

# TODO: Write a failing test case to demonstrate what isn't working as
# expected
RSpec.describe Post do
describe 'validations' do
it { is_expected.to validate_uniqueness_of(:body) }
end
end
4 changes: 2 additions & 2 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

gem "appraisal", "2.4.0"
gem "appraisal", "2.5.0"
gem "bundler", "~> 2.0"
gem "pry"
gem "pry-byebug"
Expand All @@ -20,7 +20,7 @@ gem "yard"
gem "spring"
gem "spring-watcher-listen", "~> 2.0.0"
gem "rails-controller-testing", ">= 1.0.1"
gem "rails", "6.1.7.2"
gem "rails", "6.1.7.6"
gem "puma", "~> 5.0"
gem "sass-rails", ">= 6"
gem "turbolinks", "~> 5"
Expand Down
Loading

0 comments on commit fef79d2

Please sign in to comment.