Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: thoughtbot/shoulda-matchers
...
head fork: thoughtbot/shoulda-matchers
This comparison is big! We're only showing the most recent 250 commits
Commits on Apr 11, 2014
Elliot Winkler mcmire Add missing description to #permit matcher fd31534
Elliot Winkler mcmire Fix Cucumber tests to run migrations in test env
Under the Rails 4.1 appraisal the Cucumber tests are failing because of
this error:

    Migrations are pending. To resolve this issue, run:

        bin/rake db:migrate RAILS_ENV=test
d959505
Aaron Vasquez AaronVasquez fix doc typo for validate_uniqueness_of 3e93a3c
Elliot Winkler mcmire Update NEWS wrt Rails 4.1 compatibility d8d510f
Damian Galarza dgalarza Do not permanently overwrite Parameters#[]
When stubbing the `ActionController::Parameters#[]` method, do not
permanently overwrite it. Restore the method after verifying simulating
the controller action.
6065649
Elliot Winkler mcmire Add missing entries to NEWS bb1aa83
Commits on Apr 12, 2014
Elliot Winkler mcmire Fix `belong_to` used with polymorphic association
For a polymorphic belongs_to association, the association doesn't
actually point to a class, it points to a concept, so we can't check
that the model it points to exists.
c590a60
Elliot Winkler mcmire Bump to version 2.6.0 8fa9d8c
Commits on Apr 15, 2014
Jennifer Page jmpage Fix thoughtbot/shoulda-matchers#483 by using a less precise `diff_to_…
…compare` value for large numbers in `ComparisonMatcher`.
36ed5ff
Commits on Apr 16, 2014
Anthony Williams antw Only include ActiveRecord matchers if AR is defined
Fixes cases where you may be using ActiveModel without ActiveRecord.

Also add a test for loading without ActiveRecord.

The Cucumber feature creates a Gemfile containing ActiveModel and
shoulda-matchers, and then asserts that both can be loaded without any
errors.

The ActiveModel version used will match that of the Rails version
specified in the Appraisal Gemfile; and if no such version can be
determined, the latest will be used.

Closes #480.
7f42594
Elliot Winkler mcmire Raise CouldNotSetPasswordError more safely
It seems that adding a restriction to allow_value to raise
CouldNotClearAttribute if nil cannot be set on the attribute in question
broke a lot of people's tests. Really the only reason we added this was
for validate_presence_of -- it rescued CouldNotClearAttribute and
re-raised it as CouldNotSetPasswordError, but only for passwords and
only if has_secure_password was being used. So, I've figured out another
way of performing this check inside of validate_presence_of only to
prevent tests that have nothing to do with from breaking unnecessarily.
a21426c
Elliot Winkler mcmire Add instructions for Spring users to README a5623e7
Elliot Winkler mcmire Fix callback matchers to take controller instances
Controller matchers operate on instances of controllers, not controller
classes themselves.
025dfdc
Elliot Winkler mcmire Fix the `permit` matcher to be less intrusive
Within the `permit` matcher, we need to keep track of when #permit was
called and which arguments it was called with. Previously we did this by
overriding ActionController::Parameters#[] to return an instance of
StubbedParameters (which, when #permit was called on it, would then
track the call).

This has three problems:

* We're overriding something in a global class. We can simply override
  something on the controller that's being tested instead.
* Overriding #[] is kind of magical. How does this even end up doing
  what we want? Really we should just replace the entire params hash.
* Controller tests involve hitting actions on real controllers. Those
  actions may need to access the params hash. Completely changing how
  the params hash works prevents them from being able to do that.

To solve this, we override the params hash on the controller under test
with an instance of StubbedParameters, which decorates the original
params hash. We then override #permit to track the call, but then we let
it do its thing.
2d52f53
Elliot Winkler mcmire Add missing NEWS entry for callback matchers fix 8f933f8
Commits on Apr 22, 2014
Elliot Winkler mcmire Rewrite tests for ensure_inclusion_of
ensure_inclusion_of is pretty complex. Not only does it support two ways
of specifying valid values (in_array, in_range), but it also supports
multiple column types (string, integer, float, decimal, boolean).

When it comes to handling numbers and strings, ensure_inclusion_of has
very similar logic, and we can test these cases similarly.

We also do not have tests for handling regular Ruby attributes as
opposed to database columns (validates_inclusion_of works with both).
Those tests will be added in a future commit, this commit lays the
groundwork for that.
c7b1505
Elliot Winkler mcmire Add a small stubbing library
This provides a robust solution for temporarily stubbing (and
unstubbing) methods. It will be internally by the strong parameters and
delegation matchers.
dfebd81
Elliot Winkler mcmire Fix several issues with strong parameters matcher
* Instead of decorating controller params, use our "Doublespeak"
  mini-library to stub ActionController::Parameters. This prevents from
  interfering with the params object if it is used in various ways, i.e.
  if `params.fetch(...).permit(...)` is used instead of
  `params.require(...).permit(...)`.
* Fix compat with Rails 4.1, where the verb for #update is PATCH not
  PUT
* Track multiple calls to #permit within a given controller action
* Fix so that if the route for your action requires params (such as
  :id) then you can specify those params
218293a
Elliot Winkler mcmire Fix delegate_method to double objects properly
Use our Doublespeak mini-library to stub the target method on the object
in question, ensuring that the stubs we create during matching get
reversed when the match ends.

Also:

* Make it possible to negate the matcher, and use negation in tests
  rather than !matches?
* If the matcher fails, add more information to the failure message as
  to what was actually called on the target object
6d286aa
Elliot Winkler mcmire Fix ensure_inclusion_of to support plain attrs
Also add missing tests to confirm this behavior.
64ed1d7
Elliot Winkler mcmire Fix NonNullableBooleanError so it contains attribute name 67b8813
Elliot Winkler mcmire Bump to version 2.6.1.rc1 d7a3548
Commits on Apr 24, 2014
Elliot Winkler mcmire Rename method to match other Rails version methods ee2eca4
Iván Valdés ivanvc Fixes uniqueness matcher for enum columns
In Rails 4.1, if the scope from a validates_uniqueness_of matcher is an
enum, next_value won't get the correct value, then tests will fail even
that validation works. This adds a way to check if the scoped attribute
is an enum, and correctly get the next value.
d4b1fc2
Commits on Apr 26, 2014
Elliot Winkler mcmire allow_value.with_message takes i18n interp values 01c9d08
Elliot Winkler mcmire v_n_o no longer treats numbers as floats
Essentially validate_numericality_of when used with a comparison
qualifier required you to use only_integer when the validation itself
had only_integer on it, because the boundaries of the comparison were
tested using small decimal numbers rather than whole numbers. This
change was introduced in bc110f7, but is obviously is a backward
incompatible change, so we are reverting it.
23ff55f
Elliot Winkler mcmire Fix tests for ComparisonMatcher to use proper error messages 91c6992
Commits on Apr 27, 2014
Elliot Winkler mcmire Bump to version 2.6.1.rc2 cdcea5a
Commits on Apr 30, 2014
Elliot Winkler mcmire Bump version to 2.6.1 1511ed9
Commits on May 09, 2014
Elliot Winkler mcmire Speed up repeated execution of unit tests
In the Cucumber tests, we do not access the Internet to install test
dependencies -- we assume that you've already run `bundle install` or
`appraisal install` to install those dependencies. Change the RSpec
tests so that the same thing happens.
2748b75
Elliot Winkler mcmire Revert 561ac3e
(Change `validate_uniqueness_of_matcher` to give non-null columns
default values)

This sounds good in theory, but we cannot choose default values that
make sense in every single context. For instance, if the column only
accepts certain values, then a default value must be chosen which is one
of those values. There is no way we can know this. Instead of making
`validate_uniqueness_of` magical, we should insist that people
create a record that has the proper attributes with the proper values
before using `validate_uniqueness_of`.
380d18f
Commits on May 21, 2014
Elliot Winkler mcmire Add missing test dependences to Appraisals
Since as of commit 2748b75, we no
longer install dependencies inside of the Rails app that is generated
and used to run all of the tests, we have to require all of the
dependencies that the app would install inside of the appropriate
Appraisals.

This was mostly straightforward except for some workarounds with the
turn gem:

* Rails 3.1 requires two versions of turn depending on which Ruby
  version you're using. On 1.9.2, it uses turn 0.9.2; after 1.9.2, it
  uses ~> 0.9.3. To accommodate this we have to have two versions of the
  Rails 3.1 appraisal which declare the different turn versions.
* Rails 3.1 also loads the turn gem even if, in the Gemfile for the app,
  turn is declared with `require: false`. This causes a problem while
  running our tests because turn actually requires minitest/autorun,
  which adds a hook so when Ruby exits, Minitest tests are run. Because
  we're already using RSpec, Minitest will try to re-run the `rspec`
  command we ran within a Minitest environment. This will fail since we
  are using RSpec-specific command line options to run the tests.
  Unfortunately there's no way to shut off minitest/autorun after it's
  been required, so we have to monkey-patch Minitest's #run method so
it's a no-op.
f13e069
Commits on Jun 20, 2014
Elliot Winkler mcmire Simplify installation instructions
Also, shoulda-matchers needs to be required in rails_helper under RSpec
3.x instead of spec_helper.
0444454
Elliot Winkler mcmire Move dev dependencies to Gemfile
Currently some dev dependencies are in the Gemfile, and some are in the
gemspec. The dependencies in the Gemfile are there because they are
using Bundler-specific options, so there is a legitimate reason for them
to be there, however, it's confusing to have gems in two places. So the
common denominator is to have them in the Gemfile.
ed42841
Elliot Winkler mcmire Extract examples in README to inline documentation c22d7c8
Elliot Winkler mcmire Generate docs using YARD 4d8faed
Elliot Winkler mcmire Publish new docs when releasing a new version 9b5fe69
Commits on Jun 21, 2014
Elliot Winkler mcmire Remove link to documentation on github.io for now bd52c97
Commits on Jun 22, 2014
Elliot Winkler mcmire Fix method links in README to work on GH and YARD 5c3fa7b
Elliot Winkler mcmire Rename yard.watchr to docs.watchr
I keep wanting to write this, so let's just change it.
a88de1f
Adam89 Use proper enumerable method
Instead of using `select` and a not to get all the false matchers
we are now using `reject` to return them.
ba744ba
Doug Orleans dougo Allow multiple StrongParametersMatchers to exist at once.
The provided RSpec example looks a bit contrived, but it corresponds to
this perfectly reasonable Minitest test case that was not working:

  class UserControllerTest < ActionController::TestCase
    should permit(:name).for(:create)
    should_not permit(:admin).for(:create)
  end

This instantiates two matchers at class load time, which resulted in the
second one overriding the double collection of the first one. Then when
the tests are executed, the first matcher would fail, because its double
is not listening to ActionController::Parameters#permit -- only the
second matcher's double collection gets activated.

This is fixed in Doublespeak by only creating one double collection per
class.
f81add5
Commits on Jun 26, 2014
Sean Doyle seanpdoyle Add `validate_uniqueness_of_(:foo).allow_blank` fcbc16e
Commits on Jun 27, 2014
Elliot Winkler mcmire Revert "Add `validate_uniqueness_of_(:foo).allow_blank`"
This reverts commit fcbc16e.

This commit is slated for the 2.7.0 release.
e349381
Elliot Winkler mcmire Add a script to install appraisals in all supported Rubies b71996e
Elliot Winkler mcmire Adjust gem install script to not use latest Ruby
We're already using the "latest" Ruby which is 2.1.1 at this point in
time.
dd89ff2
Elliot Winkler mcmire Add a script to run all tests on all Rubies a1e2f19
Elliot Winkler mcmire Use same assertion class as Rails, if loaded
Given this scenario:

* Using Rails 4.1
* Gemfile has `gem 'shoulda-matchers', require: false`
* spec_helper has `require 'shoulda/matchers'` following
  `require 'rspec/rails'`
* Using Spring to run tests

matchers that delegate to assertions in Rails (e.g. `render_template`
and `route`) will fail in the wrong way if used. They fail because in
order to use these assertions, we expect that the assertions will
raise a specific exception, an exception that corresponds to whichever
test framework that Rails is using. For Rails versions that used
Test::Unit, this is Test::Unit::AssertionFailedError. For current Rails
versions, which now use Minitest, this exception is Minitest::Assertion.

The problem is that instead of asking Rails which exception class it's
using, we are trying to detect this exception class ourselves (for
cases in which Rails is not being used). This leads to the wrong class
being detected: when using a Rails version that uses Minitest, we choose
Test::Unit::AssertionFailedError as the class. This happens using the
exact scenario above because even though shoulda-matchers is loaded
after rspec-rails, rspec-rails itself defines
Test::Unit::AssertionFailedError.

Also add Cucumber tests that confirms this exact scenario works.
12543ed
Elliot Winkler mcmire Tweak failure message for allow_value
allow_value currently gives an error message that looks like this:

    Expected errors to include "must be greater than 0" when amount is set to 0, got errors: ["amount must be greater than 0.0 (0)"]

This is confusing because the error message here is "must be greater than 0.0",
not "amount must be greater than 0.0".

With this commit the message changes to:

    Expected errors to include "must be greater than 0" when amount is set to 0, got errors: ["must be greater than 0.0 (attribute: "amount", value: 0)"]
2a7389e
sergey kuchmistov caulfield Prefer protected over private attributes 198570d
sergey kuchmistov caulfield Delete method redefining for OptionVerifier 0d84ded
sergey kuchmistov caulfield Delete unused variable 83ba542
Commits on Jul 02, 2014
Elliot Winkler mcmire Use the correct appraisal names in .travis.yml 0c91ffe
Commits on Jul 19, 2014
Elliot Winkler mcmire Remove all Ruby-emitted warnings
Run RSpec tests with warnings enabled so we stay on top of this better
in the future.
12cc7aa
Elliot Winkler mcmire Add delegate_matcher to README 72f003d
Elliot Winkler mcmire Bump version to 2.6.2 8886657
Elliot Winkler mcmire The matcher is actually called delegate_method 897e0f2
Elliot Winkler mcmire Fix autoredirect to docs for latest version dafed68
Elliot Winkler mcmire Link to the new docs f356561
Commits on Jul 21, 2014
Jacob Morris jacobsimeon Check correct columns are present in join table
The `have_and_belong_to_many` matcher could give a false positive if the
join table is present but does not contain the correct columns. Check to
see if the columns exist in the join table and provide a meaningful
failure message if one or more of the columns are not present.
0695c86
Elliot Winkler mcmire Join table check for habtm w/ custom foreign keys should still work
If the habtm association in question specifies a custom foreign_key or
association_foreign_key, when the habtm matcher checks that the join
table has the correct columns, it should use the specified column names
instead of the defaults.
48f45e8
Commits on Jul 22, 2014
Elliot Winkler mcmire Add NEWS for #511 7e14529
Maxim Kashchenko mkaschenko ensure_inclusion_of => validate_inclusion_of 93c2336
Commits on Jul 24, 2014
Elliot Winkler mcmire Add styling for documented deprecated methods 06070f9
Elliot Winkler mcmire Deprecate ensure_inclusion_of 15d0cee
Elliot Winkler mcmire Add NEWS for #508 fcdd860
Maxim Kashchenko mkaschenko ensure_exclusion_of => validate_exclusion_of acb02d0
Elliot Winkler mcmire Deprecate ensure_exclusion_of 3863c1e
Elliot Winkler mcmire Add NEWS for #524 bbd5f7f
Elliot Winkler mcmire Silly :nodoc:'s! 2ad16d4
Commits on Jul 26, 2014
Adam89 Delegate to private methods
Previously if a class delegated to a private method the `matches?`
method would return `false`. This was because`respond_to?` always
returns `false` for private methods, this commit fixes this by making
`respond_to?` evaluate private methods.
b639f83
Elliot Winkler mcmire Tweak latest NEWS entry d5c2841
Dave Schweisguth dschweisguth Emit BOOLEAN_ALLOWS_BOOLEAN_MESSAGE regardless of the order of the ar…
…ray of all booleans

Documented ensure_inclusion_of change
8376dd2
Elliot Winkler mcmire Import Source Sans Pro italic in YARD docs 5180887
Elliot Winkler mcmire Document that validate_inclusion_of may produce a warning c998907
Commits on Aug 08, 2014
Osamu TAKEUCHI Add missing tests for `set_session` 2cbec85
Osamu TAKEUCHI Fix `set_session.to(nil)` to no longer be a no-op 86fb6b9
Commits on Aug 14, 2014
Tamir Duberstein tamird FilterParamMatcher supports Regexps 1cd4a4c
Pedro Nascimento lunks Using RSpec 3 for development. 1f24f04
Adam Adam89 Allow delegate_method to be required independently
This allows the use of the delegate matcher without active support,
fix for issue #561.

* Change `blank?` to `to_s.empty?`
dbf4900
Maarten Claes mcls Get validates_uniqueness_of to work better with `NOT NULL` columns
Instead of having to persist the subject, like so:

  describe 'validations' do
    subject { build(:model) }
    it { validates_presence_of :required_attr }
    context "persisted" do
      # Needs to be persisted to prevent NOT NULL db error
      subject { create(:model) }
      it { validates_uniqueness_of :unique_attr }
    end
  end

You can now just write:

  describe 'validations' do
    subject { build(:model) }
    it { validates_presence_of :required_attr }
    it { validates_uniqueness_of :unique_attr }
  end

When required the matcher saves the record to the database.
6128af9
Maarten Claes mcls Updated docs for `ValidateUniquenessOfMatcher` [ci skip] b8f2454
Elliot Winkler mcmire Tweak validate_uniqueness_of docs [ci skip] 2f673e8
Elliot Winkler mcmire Tweak this test so it's easier to read e2b8376
Elliot Winkler mcmire Tweak warning to be descriptive, not prescriptive
While we do advise against using the validates_inclusion_of or
validates_format_of validations with boolean columns, we won't judge
if you would like to do so.
c714193
Alexey Blinov nilcolor validate_absence_of: cast `@attribute` to String
ActiveRecord.columns_hash returns Hash with String keys.
This is why `it { expect(offer).to validate_absence_of(:expired_at) }`
is not working.
1658592
Commits on Aug 26, 2014
Mauro George maurogeorge Create the define_enum_for matcher eaa970e
Commits on Aug 27, 2014
George Millo georgemillo Typo fix in ensure_length_of documentation
Fixing incorrect method name in documentation.
5c9ed2b
Marcio Junior marcioj Updated accept_nested_attributes_for_matcher docs [ci skip]
The matcher is in singular (accept_nested_attributes_for). But the AR class method have to be in plural (accepts_nested_attributes_for)
c926c9d
Commits on Aug 28, 2014
Elliot Winkler mcmire Add documentation, news for define_enum_for f26ce19
Commits on Aug 29, 2014
Elliot Winkler mcmire Rename DelegateMatcher to DelegateMethodMatcher
Matcher classes are named after the matcher method itself.
b695c2f
Elliot Winkler mcmire Fix erratum in docs for delegate_method f1eedd7
Commits on Sep 03, 2014
Elliot Winkler mcmire Reword failure message for #delegate_method
Currently it says something like this:

    Expected Person#name to delegate to Person#company as #company_name

However, this isn't in line with proper terminology. It doesn't make
sense to say that one method delegates to another; you delegate a method
to another object. So now it says:

    Expected Person to delegate #name to #company object as #company_name

Additionally, we now clarify that #company (in this example) -- or
rather the object returned by #company -- is the delegate object, and if
this object never receives any method calls we say so. Instead of this:

    Calls on Person#company: ...

we say:

    Method calls sent to Person#company: ...

Furthermore, the description (which is shown as the tests are run) was
not correct when `delegate_method` was used against a class rather than
an instance. As an example, the following code:

    it { expect(Person).to delegate_method(:name).to(:company) }

would print out as

    should delegate #name to #company object

and now it prints out as

    should delegate .name to .company object
29b1446
Elliot Winkler mcmire Move deprecations first, before bug fixes etc. d53ee94
Elliot Winkler mcmire Bump version to 2.7.0 eb4d9e5
Elliot Winkler mcmire Fix rake task to generate docs
`--ignore-removal` is no longer an option to `git add`.
2a4b9f1
Commits on Sep 12, 2014
Elliot Winkler mcmire Separate Cucumber step definitions and helpers so they can be shared 0de39be
Commits on Oct 08, 2014
Elliot Winkler mcmire Add Cucumber setup for testing standalone Ruby applications de7e550
Elliot Winkler mcmire Fix WarningsSpy to capture more lines
If you had a bunch of lines that looked like this:

    /path/to/some/file:13:in `some_method': Some error (SomeException)
    Another line for the error
        /path/to/file1.rb:44:in `some_method'
        /path/to/file2.rb:29:in `some_other_method'

The first line would not be captured and re-send to standard out. This
commit fixes that.
caa87ae
Elliot Winkler mcmire Add minitest to Rails 3.x appraisals
The minitest dependency is necessary in order to write Cucumber tests
that depend on Minitest.
db7723d
Elliot Winkler mcmire Fix delegate_method when used with shoulda-context
When specifying a custom subject, a straightforward usage of
`delegate_method`, such as the following

    class UserPresenter
      delegate :id, to: :user

      attr_reader :user

      def initialize(user)
        @user = user
      end
    end

    class UserPresenterTest < ActiveSupport::TestCase
      subject { UserPresenter.new(User.new) }
      should delegate_method(:id).to(:user)
    end

would error with something like:

    ArgumentError: wrong number of arguments (0 for 1)

This happens because the `should` method in shoulda-context asks the
DelegateMethodMatcher object for its description so that it can use it
to give the test a name and create a method that Test::Unit can run.
Now, the matcher's description needs a subject in order to determine
whether a class or an instance is being tested here -- if a class is
being tested the description will be "should delegate #id to \#user
object", if a class then "should delegate .id to .user object".
Unfortunately the matcher doesn't know what the subject is before
its #description method is called -- it only knows about this when it
gets evaluated.

Within the matcher we do have access to the current context class, so we
could read the subject block off of it and evaluate it. However, in
order to properly do this we also need access to the instance of the
test itself, which we do not have until the matcher is evaluated (by
which point it's too late).

Since there's really no way to solve this problem apart from rewriting a
lot of shoulda-context, and since often times your subject is an
instance and not a class, just assume it's an instance in this case.
c683aed
Commits on Oct 09, 2014
Elliot Winkler mcmire Update NEWS for #591 ec71c24
Elliot Winkler mcmire Fix define_class/model to support namespaces
You can now say `define_class('Models::User')` and it will define a User
class inside of the Models module.

Similarly, you can also say `define_model('Models::User')` and it will
set the table name of the model to `models_users` instead of just
`users`.
72e2b34
Adrià Planas planas Fix uniqueness matcher when scope is a *_type attr
Secondary author: Elliot Winkler <elliot.winkler@gmail.com>

This commit fixes `validate_uniqueness_of` when used with `scoped_to` so
that when one of the scope attributes is a polymorphic *_type attribute
and the model has another validation on the same attribute, the matcher
does not fail with an error.

As a part of the matching process, `validate_uniqueness_of` tries to
create two records that have the same values for each of the attributes
passed to `scoped_to`, except one of the attributes has a different
value. This way, the second record should be valid because it shouldn't
clash with the first one. It does this one attribute at a time.

Let's say the attribute in question is a polymorphic *_type attribute.
The value of this attribute is intended to be the name of a model as a
string. Let's assume the first record has a meaningful value for this
attribute already and we're trying to find a value for the second
record. In order to produce such a value, `validate_uniqueness_of`
generally calls #next (a common method in Ruby to generate a succeeding
version of an object sequentially) on the first object's corresponding
value. So in the case of a *_type attribute, since it's a string, it
would call #next on that string. For instance, "User" would become
"Uses".

You might have noticed a problem with this, which is "what if Uses is
not a valid model?" This is okay as long as there's nothing that is
trying to access the polymorphic association. Because as soon as this
happens, Rails will attempt to find a record using the polymorphic type
-- in other words, it will try to find the model that the *_type
attribute corresponds to. One of the ways this can happen is if the
*_type attribute in question has a validation on it itself.

Let's look at an example.

Given these models:

``` ruby
class User < ActiveRecord::Base
end

class Favorite < ActiveRecord::Base
  belongs_to :favoriteable, polymorphic: true
  validates :favoriteable, presence: true
  validates :favoriteable_id, uniqueness: { scope: [:favoriteable_type] }
end

FactoryGirl.define do
  factory :user

  factory :favorite do
    association :favoriteable, factory: :user
  end
end
```

and the following test:

``` ruby
require 'rails_helper'

describe Favorite do
  context 'validations' do
    before { FactoryGirl.create(:favorite) }
    it do
      should validate_uniqueness_of(:favoriteable_id).
        scoped_to(:favoriteable_type)
    end
  end
end
```

prior to this commit, the test would have failed with:

```
Failures:

  1) Favorite validations should require case sensitive unique value for favoriteable_id scoped to favoriteable_type
     Failure/Error: should validate_uniqueness_of(:favoriteable_id).
     NameError:
       uninitialized constant Uses
     # ./spec/models/favorite_spec.rb:6:in `block (3 levels) in <top (required)>'
```

Here, a Favorite record is created where `favoriteable_type` is set to
"Uses", and then validations are run on that record. The presence
validation on `favoriteable_type` is run which tries to access a "Uses"
model. But that model doesn't exist, so the test raises an error.

Now `validates_uniqueness_of` will set the *_type attribute to a
meaningful value. It still does this by calling #next on the first
record's value, but then it makes a new model that is simply an alias
for the original model. Hence, in our example, Uses would become a model
that is aliased to User.
4ad1520
Elliot Winkler mcmire Add NEWS for #592
[ci skip]
585f651
Sean Doyle seanpdoyle Improve failure message when `has_many` is missing
When test driving, writing an expectation such as

```ruby
it { should have_many(:children).through(:relationships).source(:child) }
```

used to provide the not-so-helpful error message

```
Failure/Error: it { should have_many(:children).through(:relationships).source(:child) }

     NoMethodError:

       undefined method `options' for nil:NilClass
```

The improved error message is

```
Expected Parent to have a has_many association called children (no association called children)
```
aa97369
fervic fervic Fix 'delegate_method_matcher.rb' link in README.md
This is in accordance to commit #b695c2f97854767
5cf60b7
Ken Liu kenliu fix typo in README 84e9015
Matt Gibson mattgibson Make sure foreign keys can be specified as symbols for has_and_belong…
…s_to_many associations.
0dd79ce
Commits on Oct 16, 2014
Elliot Winkler mcmire Update guide on CONTRIBUTING
As a contributor you're no longer required to add NEWS items. We'll do
that ourselves :)
19d6288
Commits on Oct 17, 2014
Elliot Winkler mcmire Remove require that was causing warnings ca02b6b
Elliot Winkler mcmire Tweak allow_value failure_message
This commit changes the failure message that `allow_value` generates so
that it reads a bit nicer.

When a call to #valid? resulted in validation messages, `allow_value`
formerly failed with this message:

    Expected errors to include "the message" when attr is set to "some value", got errors: ["another message (attribute: \"attr\", value: \"some value\")", "some other message (attribute: \"attr2\", value: \"some other value\")"]

Now it fails with this message:

    Expected errors to include "the message" when attr is set to "some value",
    got errors:
    * "another message" (attribute: attr, value: "some value")
    * "some other message" (attribute: attr2, value: "some other value")

Similarly, when a call to #valid resulted in an exception, `allow_value`
formerly failed with this message:

    Expected errors to include "the message" when attr is set to "some value", got: some message

Now it fails with this message:

    Expected errors to include "the message" when attr is set to "some value",
    got: "some message"
a23081f
Elliot Winkler mcmire Remove warning from RSpec
RSpec 3 will no longer infer the spec type from the file location, so
2.99 prints this warning:

    --------------------------------------------------------------------------------
    rspec-rails 3 will no longer automatically infer an example group's spec type
    from the file location. You can explicitly opt-in to this feature using this
    snippet:

    RSpec.configure do |config|
      config.infer_spec_type_from_file_location!
    end

    If you wish to manually label spec types via metadata you can safely ignore
    this warning and continue upgrading to RSpec 3 without addressing it.
    --------------------------------------------------------------------------------

So this commit merely adds the snippet to get rid of that warning.
2d32a71
Elliot Winkler mcmire Refactor some allow_value tests
Specifically, tests around the :against option to `with_message`.

* Extract record builder to a separate helper method / class in
  AllowValueMatcherHelpers
* Fix ModelBuilder and ClassBuilder so that they can be required in
  isolation
54c7ad1
Elliot Winkler mcmire Refactor validation_confirmation_of tests
Extract record builder code to
builder_for_record_validating_confirmation (located in
Helpers::ConfirmationMatcherHelpers). This includes the name of the
attribute being tested, as this doesn't really matter to our tests.
26cce03
Commits on Oct 21, 2014
Elliot Winkler mcmire Fix allow_value + i18n validation messages
Previously, `allow_value` failed when qualified with `with_message` and
the `:against` option. This also happened to propagate downward to
`validate_confirmation_of` since it uses `allow_value` + `:against`
(when a confirmation validation fails, it assigns the error message to
the *_confirmation attribute, not the attribute being confirmed).
This commit fixes both matchers.
a1d1635
Elliot Winkler mcmire Enable caching b845451
Elliot Winkler mcmire Update NEWS [ci skip] 13aeecd
Elliot Winkler mcmire Update README [ci skip] 2261d59
Elliot Winkler mcmire Update badges [ci skip] 8c87abc
Commits on Oct 22, 2014
Elliot Winkler mcmire Remove "circular require considered harmful" warning 32bea81
Elliot Winkler mcmire Upgrade to appraisal 1.0.2 a009c83
Commits on Nov 01, 2014
petedmarsh petedmarsh Add `with_primary_key` to AssociationMatchers 0f34231
Commits on Nov 04, 2014
Elliot Winkler mcmire Fix typo in have_many docs b9795b3
Elliot Winkler mcmire Reorganize unit tests, part I
* Move spec/shoulda to spec/unit_tests/shoulda
* Move spec/support/*.rb to spec/support/unit_tests/{helpers,matchers}
* Move spec_helper.rb to unit_spec_helper.rb
bbdf8a8
Commits on Nov 05, 2014
Elliot Winkler mcmire Reorganize unit tests, part II
* Change 'spec' Rake task to 'spec:unit'
* Require unit_spec_helper.rb in unit tests, not spec_helper.rb
* Re-namespace files in spec/support/unit under UnitTests
* Files in spec/support/unit/helpers no longer automatically add
  themselves to RSpec - this happens in unit_spec_helper.rb
* Extract RecordWithDifferentErrorAttributeBuilder and
  RecordValidatingConfirmationBuilder to separate files
f922613
Elliot Winkler mcmire Add new RSpec acceptance tests to replace Cucumber 3fb4cdb
Elliot Winkler mcmire Remove Cucumber tests c432a8c
Elliot Winkler mcmire Fix unit tests to use new acceptance stuff 366026b
Elliot Winkler mcmire Tell Travis how now to run the tests 1cbfcb7
Elliot Winkler mcmire Add Ruby 2.1.4 to Travis fc3bb53
Elliot Winkler mcmire Fix deprecation warning on Rails 3.2 7ef3cb6
Elliot Winkler mcmire Rename {ensure => validate}_length_of d976118
Elliot Winkler mcmire Deprecate ensure_length_of for validate_length_of 7da90b1
Elliot Winkler mcmire Rearrange some things in NEWS 090ae99
Elliot Winkler mcmire Fix another warning 4c9dfa7
Elliot Winkler mcmire Tweak allow_value failure message again
If no message is set and the matcher failed it formerly produced this
message:

    Expected errors  when attr is set to "some value"...

Now it produces this message:

    Expected errors when attr is set to "some value"...
d2a198e
Elliot Winkler mcmire Clean up acceptance tests a bit 0da09b2
Commits on Nov 06, 2014
George Millo georgemillo Typo fix 68a419a
George Millo georgemillo Updating documentation for `validate_length_of` c8bd4ce
Elliot Winkler mcmire Fix association matchers + namespaced class_name
Fix `class_name` qualifier for association matchers so that if the
model being referenced is namespaced, the matcher will correctly resolve
the class before checking it against the association's `class_name`.

Take these models for instance:

module Models
  class Friend < ActiveRecord::Base
  end

  class User < ActiveRecord::Base
    has_many :friends, class_name: 'Friend'
  end
end

Here, the `has_many` is referring to Models::Friend, not just Friend.
Previously in order to test the association, you had to write:

    describe Models::User do
      it { should have_many(:friends).class_name('Models::Friend') }
    end

Now, `have_many` will attempt to resolve the string given to
`class_name` within the context of the namespace first before treating
it as a reference to a global constant. This means you can now write
this:

    describe Models::User do
      it { should have_many(:friends).class_name('Friend') }
    end
b4bf814
Elliot Winkler mcmire Clear schema cache after each test
When running unit tests in a random order, some tests may fail as the
columns hash within a model may not be in sync with the database. This
is because the columns hash is cached outside of the model, so removing
the model from the object space and then recreating that model won't
clear the columns hash.
df6c0ef
Elliot Winkler mcmire Run tests in a random order 1a5bbfa
Elliot Winkler mcmire Upgrade 4.1 appraisal to Rails 4.1.7
This version fixes a bug with habtm and a namespaced class name so that
when the association looks up that class it will look inside the model
namespace instead of the global namespace.
2162965
Commits on Nov 18, 2014
Elliot Winkler mcmire Fix validate_inclusion_of + with_message
It did not fail if the given message did not match the message on the
validation itself.
5f8c323
Elliot Winkler mcmire Re-sort list of matchers in README
[ci skip]
cb549b3
Commits on Nov 19, 2014
Josh Kalderimis joshk Use the new beta build env on Travis
faster vm boot times
more cpus
more ram
better network

docs coming soon
dca7c96
Elliot Winkler mcmire Convert from Mocha to RSpec Mocks 3a76f93
Elliot Winkler mcmire Refactor route specs a1dbca3
Elliot Winkler mcmire Fix route matcher to fully work with non-string params
When using a string to specify controller and action, other parameters
needed to be specified as strings. This commit fixes `route` so that
this does not need to be the case.
abb087e
Elliot Winkler mcmire Ensure route matcher works with namespaced controllers 47a0392
Commits on Nov 20, 2014
Sean Doyle seanpdoyle Add `validate_uniqueness_of_(:foo).allow_blank`
This re-applies fcbc16e.
0e2e9c4
Elliot Winkler mcmire Add missing issue number [ci skip] 5a057a0
Commits on Nov 21, 2014
Elliot Winkler mcmire Remove unnecessary file c41ec11
Elliot Winkler mcmire set_the_flash => set_flash 0eb1091
Elliot Winkler mcmire Deprecate set_the_flash in favor of set_flash c8fb802
Elliot Winkler mcmire Reorganize set_session tests 5cfe040
Elliot Winkler mcmire Bring set_session in line with set_flash
* Deprecate `set_session(:foo)` in favor of `set_session[:foo]`
* Make both #[] and #to optional (`should set_session` simply checks
  that the session is non-empty, `should set_session.to('value')` checks
  that *any* value is 'value')
* Add support for regexps to #to
* Deprecate `should set_session(...).to(nil)` in favor of using
  `should_not set_session`
* Improve failure message
b84ec8c
Commits on Dec 13, 2014
Elliot Winkler mcmire Move uniqueness validation to ActiveRecord module cf76d74
Mauro George maurogeorge Add documentation to validates_presence_of on qualifier
[ci skip]
51283c0
Commits on Dec 14, 2014
Elliot Winkler mcmire Rename vars in delegate_method to match terminology in docs 1694c7b
Commits on Dec 15, 2014
Elliot Winkler mcmire Improve certain names of tests for delegate_method f82d4ee
Commits on Dec 16, 2014
Aditya Kapoor aditya-kapoor Add with_prefix to delegate_method
Secondary author: Elliot Winkler <elliot.winkler@gmail.com>
18201d4
Elliot Winkler mcmire Remove warning when running tests 502a2d3
Aditya Kapoor aditya-kapoor Correct link to set_flash in README
[ci skip]
0c66220
Commits on Dec 17, 2014
Elliot Winkler mcmire Revert "Remove unnecessary file"
This reverts commit c41ec11.
73e2a18
Elliot Winkler mcmire Move test for validate_length_of to the right place 76c2f66
Elliot Winkler mcmire Fix warnings spy so it doesn't capture more things than necessary b028927
Elliot Winkler mcmire Fix warning for this file ab08fef
Elliot Winkler mcmire Be better about looking for warnings on Travis b408287
Elliot Winkler mcmire Improve failure messages for failure message matchers 8e049c1
Commits on Dec 24, 2014
Elliot Winkler mcmire Add Appraisal for Rails 4.2 5aed533
Commits on Dec 25, 2014
Elliot Winkler mcmire Fix test suite to properly tag example groups
When running unit tests we need to ensure that we are simulating how
other people will use the matchers as best we can. This means, for
instance, tagging any example groups that test controller matchers as
controller example groups.
d86fe2d
Elliot Winkler mcmire Ensure that we are req'd after rspec in tests
Currently before running unit tests we are getting auto-required before
rspec-rails is getting required. This is bad because we need to wait
until rspec-rails is loaded before injecting Shoulda::Matchers::* into
the current RSpec context, otherwise matchers that clash with
rspec-rails (such as `render_template` will get overridden).

This is happening when creating and booting the Rails application.
Bundler will auto-require any gems in the Gemfile. One of these gems is
ourselves (via the `gemspec` line). Since there aren't any dependencies
in the gemspec, there's no need for us to be in the Gemfile.

This means that we no longer have to explicit `include` Rails
ActionController template assertions in the tests for `render_template`
as they should get included automatically for us.
a9ab351
Elliot Winkler mcmire Fix AC matcher tests for Rails 4.2
Modify helper methods provided by ControllerBuilder so that we use as
much of rspec-rails's controller example group capabilities as possible.
All of this can still be improved but this is a good start for now.
fab4f02
Elliot Winkler mcmire Ensure that ActiveSupport warnings are being printed during tests 7dfbc5e
Elliot Winkler mcmire Fix AR matcher tests for Rails 4.2 547d8b7
Elliot Winkler mcmire Remove warning about #capture under 4.2+ c492416
Elliot Winkler mcmire Fix acceptance tests where we should be using Bundler 8223420
Elliot Winkler mcmire Add NEWS for Rails 4.2 [ci skip] 70faac7
Elliot Winkler mcmire Bump top supported Ruby version to 2.1.5
[ci skip]
369f32f
Elliot Winkler mcmire Bump version to 2.8.0.rc1
[ci skip]
4aaa62f
Elliot Winkler mcmire Tweak NEWS
[ci skip]
16f87a8
Elliot Winkler mcmire Documentation updates
[ci skip]
542f715
Commits on Dec 29, 2014
Ian Zabel iwz Add Elliot Winkler to authors b1b95d4
Commits on Jan 04, 2015
Elliot Winkler mcmire Configure Hound
* Prefer single quotes to double quotes
* Align method parameters with fixed indentation

[ci skip]
4450f85
Elliot Winkler mcmire Fix 3.1_1.9.2 appraisal so Travis does not error out 239487c
Commits on Jan 05, 2015
Luciano Sousa lucianosousa uniqueness: Refactor code to set next value 9b252cc
Commits on Jan 20, 2015
Elliot Winkler mcmire Add callback matchers to README 7f13068
Elliot Winkler mcmire Add script to update a gem in all appraisals 45f3960
Sean Devine barelyknown Dependent qualifier now supports more values
* :destroy
* :delete
* :nullify
* :restrict
* :restrict_with_exception (Rails 4+)
* :restrict_with_error (Rails 4+)
* true
* false
948757b
Commits on Jan 23, 2015
Elliot Winkler mcmire Use pry-nav for more debugging awesomeness 03977d1
Elliot Winkler mcmire Use correct Hound config file 060df9e
Elliot Winkler mcmire Improve output of fail_with_message matcher de111ea
Elliot Winkler mcmire Fix test that was written poorly 84a366f
Elliot Winkler mcmire Refactor submatcher logic in numericality matcher
...and also ComparisonMatcher
1766a09
Elliot Winkler mcmire Handle RangeErrors emitted now in ActiveRecord 4.2
In Rails 4.2, ActiveRecord was changed such that if you attempt to set
an attribute to a value and that value is outside the range of the
column, then it will raise a RangeError. For instance, an integer column
with a limit of 2 (i.e. a smallint) only accepts values between -32768
and +32767.

This means that if you try to do any of these three things, a RangeError
could be raised:

* Use validate_numericality_of along with any of the comparison
  submatchers and a value that sits on either side of the boundary.
* Use allow_value with a value that sits outside the range.
* Use validates_inclusion_of against an integer column. (Here we attempt
  to set that column to a non-integer value to verify that the attribute
  does not allow said value. That value is really a string version of a
  large number, so if the column does not take large numbers then the
  matcher could blow up.)

Ancillary changes in this commit:

* Remove ValidationMessageFinder and ExceptionMessageFinder in favor of
  Validator, StrictValidator, and ValidatorWithCapturedRangeError.
* The allow_value matcher now uses an instance of Validator under the
  hood. StrictValidator and/or ValidatorWithCapturedRangeError may be
  mixed into the Validator object as needed.
9ba2138
Elliot Winkler mcmire Fix NEWS [ci skip] 938e8e6
Elliot Winkler mcmire Put bug fixes above features [ci skip] eadbdf8
Elliot Winkler mcmire Remove these from the docs 5bba211
Elliot Winkler mcmire Remove all files from YARD except README and NEWS 630f0eb
Elliot Winkler mcmire Add Rails 4.2 to Travis 1e4555e
Elliot Winkler mcmire Bump version to 2.8.0.rc2 c9dc416
Elliot Winkler mcmire Exclude site and gh-pages branches from Travis c47c574
Elliot Winkler mcmire Refactor docs tasks a bit to match site tasks a409d8e
Elliot Winkler mcmire Publish docs at /docs and not /
The new site will be published at / instead.
5f59f9e
Elliot Winkler mcmire Extract documentation tasks to a separate file 6925773
Elliot Winkler mcmire Use custom github username in /docs/index.html for better testing 50b8cb8
Elliot Winkler mcmire Fix docs:generate and docs:publish with custom latest version f4bfed3
Elliot Winkler mcmire Add build/ and source/ to .gitignore 0f7bcfe
Elliot Winkler mcmire Raise an error if version or latest_version missing 4da3ecf
Elliot Winkler mcmire Make redirection to latest version domain-agnostic 5bc062e
Elliot Winkler mcmire Update link to official documentation 3787559
Elliot Winkler mcmire Prefix temporary gh pages dir with username 99a68fe
Elliot Winkler mcmire Fix link to docs, again [ci skip] 63f9c03
Commits on Jan 30, 2015
Elliot Winkler mcmire Bump version to 2.8.0 bbd0d5e
Commits on Feb 05, 2015
Elliot Winkler mcmire Fix acceptance tests to actually remove gems 021d3d6
Elliot Winkler mcmire Remove debugger, byebug, and web-console from 4.2
debugger and byebug cannot be present in Appraisals because they only
work on specific Ruby versions, and we test against a range of Ruby
versions. Hence, they can't be present in the Rails application that
gets generated in acceptance tests, either.

Also, we don't really need web-console to be there, it's just an extra
dependency.
d7f7f58
Elliot Winkler mcmire Move test for uniqueness matcher to AR directory dff472e
Elliot Winkler mcmire Test against RSpec 3 from now on
* Ruby 2.2 removed Minitest and Test::Unit from the standard library
  [[1]], [[2]]
* rspec-rails requires Test::Unit for Rails versions prior to 4.1 (which
  switched to Minitest)
* This doesn't work now, because we don't have Test::Unit present in the
  gem bundle
* RSpec 3.2.0 fixes this issue [[3]]

I don't really see this as a huge concern, since we were testing against
RSpec 2.99 for Rails < 4, and that has most of the changes that RSpec 3
has.

[1]: ruby/ruby@f8c6a5d
[2]: ruby/ruby@96f5526
[3]: rspec/rspec-rails@999ebb7#diff-08d960c572ac094640dd183fa9641393R13
b7fe87a
Commits on Feb 06, 2015
Elliot Winkler mcmire Raise an error if no Appraisal is specified
If you attempt to run tests without specifying an Appraisal, then you
will be going off of the main Gemfile. The Gemfile is not guaranteed to
contain all of the dependencies necessary to run tests, so it is very
likely that you'll get an obscure error somewhere. Instead of letting
this happen, raise a specific error.
9a903f5
Commits on Feb 09, 2015
Elliot Winkler mcmire Clean up Gemfile
* Remove Aruba and Bourne since we don't use them anymore
* Remove Rails from main Gemfile as it's already a dependency in each of
  the appraisals
* Tighten dependency on Rake to 10.x
* Move dependencies shared among appraisals to Appraisals
093268e
Elliot Winkler mcmire Fail build if there are warnings f681d35
Elliot Winkler mcmire Remove Rails 3.x, Ruby 1.9.2, Ruby 1.9.3
Ruby 1.9.3 will be end-of-lifed on February 23, 2015. We might as well
remove support for it now.
a4045a1
Elliot Winkler mcmire Change behavior of should_not allow_value
Instead of asserting that any of the given value is an invalid value
(allowing good values to pass through), assert that *all* values are
invalid values (allowing good values not to pass through).

This means that this test which formerly passed now fails (assuming that
'good value' is a value that does not produce an invalid record):

    expect(record).not_to allow_value('good value', *bad_values)
19c38a6
Elliot Winkler mcmire Remove auto-detection of Rails / test framework 1900071
Elliot Winkler mcmire Use generic test framework for independent matchers test ab91bbf
Elliot Winkler mcmire Remove deprecated matchers 55c8d09
Elliot Winkler mcmire Add SetSessionOrFlashMatcher cc27723
Elliot Winkler mcmire Remove set_the_flash in favor of set_flash 801f2c7
Elliot Winkler mcmire Consolidate set_session and set_flash APIs
* Refactor so they both use SetSessionOrFlashMatcher internally
* Remove `set_session['key']` in favor of `set_session('key')`
* `set_flash['key'].to(nil)` no longer works if set_flash has never been
  set
535fe05
Elliot Winkler mcmire Add support for Ruby 2.2
Secondary author: Luciano Sousa <ls@lucianosousa.net>

Also, upgrade to rspec-rails 3.2.0 explicitly. (See
b7fe87a for an explanation of why 3.2.0
is necessary here.)
56ded05
Commits on Feb 11, 2015
Elliot Winkler mcmire Rewrite tests for validate_uniqueness_of
* The main problem I had with the old tests is that information that
  the reader didn't need to care about was not properly abstracted away.
  For instance, a helper method used by almost all tests will always
  create a model called Example, and will always use an attribute called
  "attr" (on which the validation is present). However, in some tests
  the class or attribute is referred to directly. The reader shouldn't
  have to care about either of these things, since they are constant --
  the tests should be readable enough so that this information is not
  necessary to understand the case being tested against.

* Speaking of this helper method, some of the tests used it and some
  didn't. Some defined their own helper methods to represent a
  particular case (`case_sensitive: true`, `allow_nil`, etc.). This is
  now fixed so that all but two tests use the same helper method to
  define a model. This model is completely customizable -- one can
  specify the type of the attribute being validated, the names and types
  of scoped attributes, etc.

* The tests around scoped attributes and different types are all
  basically the same, so they are now compressed into a shared context.

* Related to this, we no longer have to worry about setting a proper
  value for a scope attribute. One had to know which type that attribute
  had and come up with a reasonable default for that type. Now there is
  a helper method that worries about this automatically.

* Finally, we remove tests around case_insensitive against an integer
  attribute (these don't make any sense, and don't work).
a43b8e4
Elliot Winkler mcmire Tell Travis to only build pushes to master
The rest of the time, it will build changes to PR's.
b0fe892
Elliot Winkler mcmire Remove Rubinius and JRuby from .travis.yml
Right now we tell Travis to ignore failed builds against Rubinius or
JRuby. This has been in place "temporarily" for more than 2 years, so we
effectively don't test against or support either runtime.
0f2800f
Elliot Winkler mcmire Uniqueness: Add missing tests for scopes w/ datetime + Time
Here, we are basically testing the logic that generates a next value for
a scope attribute, in the case that that attribute is a Time object
instead of a DateTime object.
eec7c20
Commits on Feb 12, 2015
Elliot Winkler mcmire Changes to CommandRunner
* Use full output instead of elided output on failure
* Refactor debugging code a bit
* Use :chdir option to Process.spawn instead of Dir.chdir
942a600
Elliot Winkler mcmire 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.
72f60fa
Elliot Winkler mcmire Stop testing against columns unsupported by SQLite 74fa081
Elliot Winkler mcmire Uniqueness: Support UUID columns that end in "f"
This commit fixes the uniqueness matcher so that when qualified with
`scoped_to` and one of the scopes is a UUID column that happens to end
in an "f", the matcher is able to generate a proper next value during
testing and doesn't error.
81034ea
Elliot Winkler mcmire Uniqueness: Add missing tests for text columns 59c8511
Commits on Feb 13, 2015
Elliot Winkler mcmire CommandRunner: if command fails, format it better 445a3ea
Guilherme Franco guilhermeFranco Fix enum attribute name verification
Fix `define_enum_for` so that it actually tests that the attribute is
present in the list of defined enums, as you could fool it by merely
defining a class method that was the pluralized version of the attribute
name. In the same vein, passing a pluralized version of the attribute
name to `define_enum_for` would erroneously pass, and now it fails.
714129b
Elliot Winkler mcmire Uniqueness: Support PG array columns for scopes
Please note that array columns do not work properly between Rails 4.0
and 4.2.

* If you set an array-of-date or array-of-time attribute to an
  array, it will fail to hold that value. This is an issue with
  timestamp-aware attributes and is fixed in Rails 4.2.

* Even if this worked, the uniqueness validator cannot cope with array
  columns, producing an invalid query. This will be fixed in 4.1.10.
6aeccd3
Commits on Feb 14, 2015
Elliot Winkler mcmire Uniqueness: Fix when scope set to nil beforehand
Switch the order of how the column type is detected so that string comes
last. This fixes a bug where if the scope was a text column but was set
to nil before running the matcher, the matcher would fail.
5194ddf
Elliot Winkler mcmire Only Postgres columns respond to :array 226ce5b
Commits on Feb 16, 2015
Elliot Winkler mcmire master == 3.0.0.alpha
There is no gem release associated with this commit, this is only so
that people who are testing against the master branch will see that the
version is not 2.8.0.

[ci skip]
c3482d1
Commits on Feb 17, 2015
Anthony Navarre + Elliot Winkler Uniqueness: Fix default behavior for case-insensitive models
If you have a model that has a uniqueness validation using
`case_sensitive: false`, and you are testing against but do not qualify
the matcher with `case_insensitive`, then the matcher will pass
unexpectedly. Take this model for instance:

    class Product < ActiveRecord::Base
      validates_uniqueness_of :name, case_sensitive: false
    end

Currently, the following test passes. With this commit, it will now
(correctly) fail:

    describe Product do
      it { is_expected.to validate_uniqueness_of(:name) }
    end
57a1922
Commits on Feb 18, 2015
Anthony Navarre + Elliot Winkler allow_value: Raise error if attr sets value differently
`allow_value` will now raise a CouldNotSetAttribute error if the
attribute in question cannot be changed from a non-nil value to a nil
value, or vice versa. In other words, these are the exact cases in which
the error will occur:

* If you're testing whether the attribute allows `nil`, but the
  attribute detects and ignores nil. (For instance, you have a model
  that `has_secure_password`. This will add a #password= method to your
  model that is defined in a such a way that you cannot clear the
  password by setting it to nil -- nothing happens.)
* If you're testing whether the attribute allows a non-nil value, but
  the attribute fails to set that value. (For instance, you have an
  ActiveRecord model. If ActiveRecord cannot typecast the value in the
  context of the column, then it will do nothing, and the attribute will be
  effectively set to nil.)

What's the reasoning behind this change? Simply put, if you are assuming
that the attribute is changing but in fact it is not, then the test
you're writing isn't the test that actually gets run. We feel that this
is dishonest and produces an invalid test.
eaaa2d8
Commits on Feb 20, 2015
Sean Doyle seanpdoyle Cache Bundler on Travis
With Container based CI, public projects can cache the results of
`bundle install`
52a15c3