Commit Graph

19 Commits

Author SHA1 Message Date
Nitin Singh 3e9d69ba7b
Fix the undefined method error for non rails project due to use of many? method. (#1459)
* Fix the undefined method error for non rails project due to use of many? method

* Add tests for inclusion validation for non rails app.

* Remove unnecessary spaces.

* Rubocop offenses.

Co-authored-by: Nitin S <nitin.singh@edcast.com>
Co-authored-by: = <=>
2021-08-31 20:04:37 -03:00
Pedro Paiva cd71a958a7
Fix exception raised by ActiveSupport Object#in? (#1405) 2021-02-05 09:11:18 -03:00
Igor Zubkov ffd5a28b45 Fix typo 2020-10-15 13:38:07 -06:00
Pedro Paiva 543c18bce9 Fix deprecation warning: 'Using a dynamic :controller/:action segment in a route is deprecated' 2020-10-15 09:18:03 -06:00
Gui Vieira d97bdd6cab
Update test versions and dependencies (#1269) 2020-01-01 12:20:50 -08:00
Vít Ondruch 984ce7340b Remove minitest reporters (#1251) 2019-11-18 18:45:13 -08:00
Alejandro Gutiérrez d49cfcae1b Adding support to allow_nil option for delegate_method matcher 2018-01-24 02:22:19 -06:00
Elliot Winkler b310986f9a Use correct migration class in acceptance tests
In Rails 5.0, migration classes changed so that they were versioned:
instead of inheriting from `ActiveRecord::Migration`, you inherited from
`ActiveRecord::Migration[5.0]`. The old way wasn't removed, however --
that is, until Rails 5.1. Hence, our acceptance tests that use the old
style no longer work under the 5.1 Appraisal.
2017-09-28 01:09:23 -05:00
Elliot Winkler 158839b3a6 Use `head` instead of `render: nothing` in tests
`render nothing: true` was removed from Rails 5.1 and has no effect
anymore -- it was replaced with `head`.
2017-09-28 01:08:55 -05:00
Elliot Winkler 1189934806 Add ignoring_interference_by_writer to all matchers
`allow_value` matcher is, of course, concerned with setting values on a
particular attribute on a particular record, and then checking that the
record is valid after doing so. That comes with a caveat: if the
attribute is overridden in such a way so that the same value going into
the attribute isn't the same value coming out of it, then `allow_value`
will balk -- it'll say, "I can't do that because that changes how I
work."

That's all well and good, but what the attribute intentionally changes
incoming values? ActiveRecord's typecasting behavior, for instance,
would trigger such an exception. What if the developer needs a way to
get around this? This is where `ignoring_interference_by_writer` comes
into play. You can tack it on to the end of the matcher, and you're free
to go on your way.

So, prior to this commit you could already apply it to `allow_value`,
but now in this commit it also works on any other matcher.

But, one little thing: sometimes using this qualifier isn't going to
work. Perhaps you or something else actually *is* overriding the
attribute to change incoming values in a specific way, and perhaps the
value that comes out makes the record fail validation, and there's
nothing you can do about it. So in this case, even if you're using
`ignoring_interference_by_writer`, we want to inform you about what the
attribute is doing -- what the input and output was. And so we do.
2016-01-05 00:58:16 -07:00
Elliot Winkler a90db8071e Fix acceptance tests to match recent changes
Descriptions and failure messages of all matchers have been updated, so
fix acceptance tests that reference either of these things.
2015-12-13 20:22:23 -07:00
Elliot Winkler e0a0200fe4 Make independent matchers really independent
Why:

* When `delegate_method` was modified a while back to add Doublespeak
  and use MatcherContext, Shoulda::Matchers::Independent became unable
  to be required independently.

To satisfy the above:

* Require Doublespeak and MatcherContext within
  `delegate_method_matcher.rb`.
* Add an acceptance test to ensure that Independent stays independent.

Secondary-Author: jc00ke <jesse@jc00ke.com>
2015-10-01 10:12:17 -06:00
Lucas D'Avila 721900b8fd Allow the use of matchers from multiple libs, for non rails projects.
* It changes shoulda-matchers to allow the integration with multiple
  libraries like active_model and active_record.

  For example, in a non Rails project isn't possible to use both
  validate_presence_of and validate_uniqueness_of matchers, because they
  are from different libraries (one from active_model and the other from
  active_record respectively).

  This change allow the integration with multiple libraries. fixes #710
2015-06-01 00:43:07 -06:00
Elliot Winkler 72f60fae94 Add support for Postgres
When running tests, you can now switch between running them against a
SQLite or PostgreSQL database. This is accomplished by modifying the
unit and acceptance tests so that when they generate and load the test
Rails application, database.yml is replaced with content that will
configure the database appropriately.
2015-02-12 16:01:00 -07:00
Elliot Winkler ab91bbf123 Use generic test framework for independent matchers test 2015-02-09 10:52:51 -07:00
Elliot Winkler 190007155e Remove auto-detection of Rails / test framework 2015-02-09 10:52:51 -07:00
Elliot Winkler 8223420ba2 Fix acceptance tests where we should be using Bundler 2014-12-25 00:45:06 -05:00
Elliot Winkler 0da09b2132 Clean up acceptance tests a bit 2014-11-05 16:39:08 -07:00
Elliot Winkler 3fb4cdb3b7 Add new RSpec acceptance tests to replace Cucumber 2014-11-05 09:53:33 -07:00