shoulda-matchers

Simple one-liner tests for common Rails functionality

MIT License

Downloads
186.2M
Stars
3.5K
Committers
322

Bot releases are hidden (Show)

shoulda-matchers - v6.3.0 Latest Release

Published by matsales28 2 months ago

6.3.0 - 2024-08-09

What's Changed

Bug fixes

  • Fix uniqueness check for a polymorphic association with STI by @matsales28 (#1624)

Features

  • Add default qualifier to define_enum_for matcher by @matsales28 (#1627)
  • Add validating qualifier to enum matcher by @matsales28 (#1630)
  • Add without_instance_methods qualifier to enum matcher by @vaot (#1636)

Improvements

  • Update dependencies of rails-6.1 gemfile by @matsales28 (#1621)
  • Update dependencies of rails-7_1 gemfile by @matsales28 (#1619)
  • Update dependencies of rails-7.0 gemfile by @matsales28 (#1620)
  • Support deprecated status code symbols by @ioquatix (#1637)
  • Remove useless logger require by @Earlopain (#1634)
shoulda-matchers - v6.2.0

Published by matsales28 7 months ago

6.2.0 - 2024-03-15

Bug fixes

  • Allow beginless and endless ranges in validates_inclusion_of by @pjpires (#1615)
  • Ensure uniqueness validation matcher works with STI by @matsales28 (#1610)

Features

  • Add against method in allow_value matcher by @EduardoSCosta (#1543)
  • Add support for strict_loading option in association matchers by @rhannequin and @laicuRoot (#1607)
  • Add have_delegated_type matcher by @matsales28 (#1606)
  • Add support for foreign_type qualifier on AssociationMatcher by @matsales28 (#1609)

Improvements

  • Lazy load ActionController and Routing matchers for ActionController::TestCase by @ilianah (#1613)
  • Call dynamic-readme reusable workflow by @stefannibrasil (#1617)
  • Update dependencies by @matsales28 (#1611)
  • Fix inline documentation for is_greater_than in validate_comparison_of matcher by @jeduardo824 (#1616)
  • Fix forgotten colon in documentation by @hotoolong (#1612)
shoulda-matchers - v6.1.0

Published by matsales28 9 months ago

6.1.0 - 2024-01-19

Bug fixes

  • Fix negative form of validate_numericality matcher by @matsales28 (#1603)

Features

  • Add support for negated matcher on have_secure_password matcher by @amalrik (#1593)
  • Add encrypt matcher to test usage of the encrypts macro by @theforestvn88 (#1581)
  • Add query_constraints qualifier on the association matchers by @matsales28 (#1604)

Improvements

  • Remove array_column? helper from ValidateAbsenceOfMatcher by @jarenas9539 (#1562)
  • Bump rubocop version to 1.59.0 by @VSPPedro (#1600)
  • Update Ruby version to 3.3.0 by @VSSPedro(#1599)
  • Fix REPRODUCTION_SCRIPT.md link returning 404 by @VSPPedro (#1602)
  • Add support for globally enabled frozen-string-literals by @amalrik (#1598)
  • Adjust typos in the documentation by @matsales28 (#1597)
shoulda-matchers - v6.0.0

Published by matsales28 10 months ago

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)

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)

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)

Improvements

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

Thanks everyone for the contributions!

shoulda-matchers - v5.3.0

Published by VSPPedro almost 2 years ago

Features

  • Add in: range matcher to validate_numericality_of by @matsales28 . (#1512)

  • Support :uuid column type for validate_absence_of matcher by @dlupu. (#1518)

Bug fixes

  • Fix confusing error message from validate_inclusion_of matcher when used against a polymorphic association. (#1523)
shoulda-matchers - v5.2.0

Published by VSPPedro about 2 years ago

Features

Thanks @technicalpickles, @dewyze, @andreLumor for your contributions!

shoulda-matchers - v5.1.0

Published by VSPPedro almost 3 years ago

Bug fixes

  • Fix the undefined method error for non rails project due to use of many? - method from ActiveSupport. (#1459)

Features

  • Add array option support for have db column matcher. (#1465)

  • Add enum attributes support for validate_absence_of matcher. (#1464)

shoulda-matchers -

Published by VSPPedro over 3 years ago

Bug fixes

  • Replace in?, method from ActiveSupport, with include? to prevent exception "undefined method in?" on non-Rails app. (#1405)

Features

  • Add support for Rails 6.1. No new Rails 6.1 features are supported, but only existing features that broke with the upgrade. (#1418)

  • Add support for RVM (Ruby Version Manager) to setting up local environment. (#1424)

  • Add support for alias in matcher define_enum. (#1419)

  • Add support for Ruby 3.0. (#1406, #1427)

Improvements

  • Remove deprecated warnings emitted on Rails 6.1 in ActiveModel errors. (#1444)

Backward-incompatible changes

  • Drop support for Rails 4.2, 5.0 and 5.1 as well as Ruby 2.4 and 2.5
    they've been end-of-lifed. The gem now supports Ruby 2.6+ and Rails 5.2+. (#1412, #1415, #1422, #1428, #1429)

  • Remove deprecated matchers: use_before_filter, use_after_filter, use_around_filter and allow_mass_assignment_of. (#1430, #1431)

shoulda-matchers -

Published by VSPPedro over 3 years ago

Bug fixes

  • Replace in?, method from ActiveSupport, with include? to prevent exception "undefined method in?" on non-Rails app. (#1405)

Features

  • Add support for Rails 6.1. No new Rails 6.1 features are supported, but only
    existing features that broke with the upgrade. (#1418)

  • Add support for RVM (Ruby Version Manager) to setting up local environment. (#1424)

  • Add support for alias in matcher define_enum. (#1419)

  • Add support for Ruby 3.0. (#1406, #1427)

Backward-incompatible changes

  • Drop support for Rails 4.2, 5.0 and 5.1 as well as Ruby 2.4 and 2.5
    they've been end-of-lifed. The gem now supports Ruby 2.6+ and Rails 5.2+.(#1412, #1415, #1422, #1428, #1429)

  • Remove deprecated matchers: use_before_filter, use_after_filter, use_around_filter and allow_mass_assignment_of. (#1430, #1431)

shoulda-matchers -

Published by VSPPedro over 3 years ago

Bug fixes

  • Update belongs_to to work with composite primary keys. (#1396)
shoulda-matchers -

Published by VSPPedro almost 4 years ago

Features

  • Add support for has_secure_password custom attributes. (#1356)

Bug fixes

  • Fix bundle exec yard doc replacing pygments.rb with rouge to keep the documentation up to date. (#1343)
  • Fix have_db_column.with_options not raising an error when the user adds an invalid value. (#1358)
  • Fix default value of assossiation_matcher.validate option. It was returning false instead of true. (#1378)
  • Fix validate_absence_of failing for array columns. (#1383)

Improvements

  • Replace all links with http to https. (#1340)
  • Update the links for have_and_belong_to_many, have_many and have_one in the README to redirect the user to where the matcher description starts. (#1348)
  • Drop git ls-files in gemspec to help downstreams maintenance, because they often need to build packages in an environment that does not have git. (#1354)
  • Add comment about no support of validate_uniqueness_of(:item).scoped_to(array). (#1355)
  • Improve error message for assossiation_matcher.with_foreign_key option. (#1376)
shoulda-matchers - v4.4.0

Published by mcmire about 4 years ago

Features

  • Add an ignoring_check_for_db_index qualifier to the have_secure_token
    matcher, since has_secure_token encourages use of an index but does not
    enforce it. (#1278)

  • Add allow_blank to validate_length_of to match other validation matchers.
    (#725, #1318)

  • Add new matcher have_implicit_order_column which can be used to test the
    implicit_order_column setting for ActiveRecord models under Rails 6+.
    (#1243)

  • Add a new is_other_than qualifier to validate_numericality_of to be able
    to test the numericality validation's :other_than option. (#1282)

  • Add a new have_one_attached and have_many_attached matchers for testing
    the new model-level ActiveStorage macros in Rails 6. (#1102)

Bug fixes

  • Fix performance of allow_value so that it doesn't hang if the given value is
    really long. (#1290)

  • Fix have_many so that it is possible to test an association that has a scope
    that takes an argument. (#952, #992)

  • Update validate_uniqueness_of to use the public validators_on instead of
    the private _validators when reading validations off of a model. This
    enables shoulda-matchers to be used with the schema_validations gem.
    (#995)

  • Update validate_uniqueness_of to work with scopes that are time columns.
    (#1190)

  • Fix have_and_belong_to_many so that when using the join_table qualifier
    you can pass a symbol rather than a string. (#1323)

Improvements

  • Update have_many when used against a :through association so that it fails
    if the inverse model does not have a belongs_to association. (#646,
    #723, c0a1578)

  • Add Ruby 2.7 to test matrix and default development Ruby. (#1310)

  • Remove warnings emitted on Ruby 2.7 in word_wrap. (#1314)

  • Remove warnings emitted on Ruby 2.7 in Doublespeak. (#1328)

  • Clean up requires within the code by converting them to autoloads. (#1320)

shoulda-matchers - v4.3.0

Published by guialbuk over 4 years ago

Features

  • Add have_rich_text matcher for ActionText (#1263)

Improvements

  • Use range on validate_exclusion_of#in_range documentation (#1273)

Bug fixes

  • Fix missing attribute:: scope 1 intermittent test: (#1274)
shoulda-matchers - v4.2.0

Published by guialbuk almost 5 years ago

Features

  • Add support for optional: false in belongs_to associations. (#1237)
  • Add support for associations with inverse_of: false and non-standard foreign key (#1106)

Bug fixes

  • Fix typos in documentation of allow_values (#1241)
  • Fix appraisal command in CONTRIBUTING.md file (#1253)

Improvements

  • Remove minitest-reporters dependency ([#1251])
  • Development dependency updates
shoulda-matchers - v4.1.1

Published by mcmire over 5 years ago

Bug fixes

  • Patch some backward-incompatible changes to validate_presence_of that were
    made in the last version. As of 4.1.0 the presence matcher now checks to
    ensure that empty string will cause the record to be invalid (in addition to
    nil, which it was already checking against). However, this check was being
    performed even if the attribute or column the presence matcher is being run
    against didn't support being set to an empty string. This releases fixes this.
    (#1222, #1224, #1231)
shoulda-matchers - v4.1.0

Published by mcmire over 5 years ago

Bug fixes

  • Fix validate_uniqueness_of so that it works when a scope is defined as a
    string instead of a symbol on the model. (#1176)
  • Fix have_db_index so that it can be used against multiple models that are
    connected to different databases. (#1200)

Features

  • Add support for Rails 6. No new Rails 6 features are supported, but only
    existing features that broke with the upgrade. (#1193)
  • Add support for expression indexes (Rails 5, Postgres only) to
    have_db_index. (#1211)
  • Add allow_nil to the validate_presence_of matcher. (834d8d0, #1100)

Improvements

  • Update validate_presence_of so that if it is being used against an
    association which is required: true or optional: false, or it is not
    configured as such but ActiveRecord defaults belong_to associations to
    optional: false, and the matcher fails, the developer is reminded in the
    failure message that the belong_to matcher can be used instead. (#1214,
    8697b01)
  • Update define_enum_for so that it produces a more helpful message on
    failure. (#1216)
shoulda-matchers - v4.0.1

Published by mcmire over 5 years ago

Fix gemspec so that setup script isn't installed globally when gem is installed.

shoulda-matchers - v4.0.0 (yanked)

Published by guialbuk over 5 years ago

  • Rails 5.x support
  • Ruby 2.4+ support
  • Improve negative versions of validation matchers
  • Drop support for Ruby 2.0 and 2.1
  • Drop support Rails 4.0 and 4.1
shoulda-matchers - v4.0.0.rc1

Published by guialbuk about 6 years ago

Adds support for Ruby 2.4 and 2.5 and Rails 5.x.
Drops support for Ruby 2.0 and 2.1 as well as Rails 4.0 and 4.1.

shoulda-matchers - v3.1.2

Published by guialbuk over 7 years ago

Deprecations

  • This is the last version that supports Rails 4.0 and 4.1 and Ruby 2.0 and 2.1.

Bug fixes

  • When the permit matcher was used without #on, the controller did not use
    params#require, the params object was duplicated, and the matcher did not
    recognize the #permit call inside the controller. This behavior happened
    because the matcher overwrote double registries with the same parameter hash
    whenever ActionController::Parameters was instantiated.

    • Commit: [44c019]
    • Issue: [#899]
    • Pull request: [#902]
Package Rankings
Top 0.31% on Rubygems.org
Top 5.6% on Proxy.golang.org
Badges
Extracted from project README
Gem Version Build Status Total Downloads Downloads shoulda-matchers