Commits on Nov 22, 2013
  1. Do not require rspec to be required before SM is

    Currently, if you want to use shoulda-matchers with RSpec, it must be
    declared after RSpec in the Gemfile. This is because SM only integrates
    with RSpec if it can see it's available; if RSpec hasn't been loaded yet
    then SM will ignore it and move on.
    This does not usually cause any issues, because even if SM is declared
    before RSpec, RSpec gets loaded before SM anyway. When you run tests,
    you use the `rspec` executable, which will require RSpec; and from here
    spec_helper will load the remainder of your environment. Therefore, SM
    will see that RSpec has been loaded and integrate with it.
    However, this does cause issues when you're running your tests with
    Spring. Spring works, like any other preloader does, by loading Rails
    and the gems in your Gemfile in a sandbox which is cached and kept
    separate from the process in which you run your tests. A sharp mind will
    notice the problem: if SM is loaded ahead of RSpec, then it will never
    integrate with RSpec, even if the `rspec` executable is later used to
    run the tests, because once SM is loaded, it's loaded for good.
    The only way to solve this is to remove the RSpec detection code which
    we have currently, and instead attempt to require RSpec ourselves.
    mcmire committed Nov 22, 2013
  2. Rewrite the README

    * Add comprehensive examples for every method in the API
    * Change Shoulda references to shoulda-matchers
    * Mention that we use SemVer
    mcmire committed Oct 23, 2013
Commits on Nov 1, 2013
  1. Fix converting association options to a Relation

    Under Rails 3 when using an association matcher in conjunction with a
    submatcher such as #order, we have to take the options on the
    association (:conditions, :order, etc.) and convert them to an
    ActiveRecord::Relation object. This happens in ModelReflector.
    Unfortunately, converting an :includes option was broken. This is in
    part due to ModelReflector not having proper tests, but also, the method
    that does the conversion to Relation is rather complex and could be
    broken up so it can be tested better. In fact I noticed that there's a
    lot of stuff in ModelReflector that does stuff around a Reflection
    object, so it would be better to define a ModelReflection class that
    simply decorates a Reflection. That's what I've done and also added
    proper tests.
    mcmire committed Oct 21, 2013
Commits on Oct 29, 2013
Commits on Oct 23, 2013
  1. RouteMatcher#to accepts a string as first param

    Some refactor
    maurogeorge committed with mcmire Oct 15, 2013
Commits on Oct 18, 2013
Commits on Oct 10, 2013
  1. Update NEWS for #363

    mcmire committed Oct 10, 2013
Commits on Sep 30, 2013
  1. Don't extend non-existing modules

    Fixes an issue where a Rails project skips the test unit railtie
    completely, eg:
    # require "rails/test_unit/railtie"
    pusewicz committed Sep 30, 2013
Commits on Sep 20, 2013
  1. Bump to version 2.4.0

    drapergeek committed Sep 20, 2013
Commits on Sep 16, 2013
  1. Create a shared example for Numercial Submatchers.

    * Verify that all submatchers respond to the necessary interface
    * See: #357 for a reason why this is necessary
    drapergeek committed Sep 16, 2013
Commits on Sep 13, 2013
  1. Use 1.9 style syntax

    drapergeek committed Sep 13, 2013
Commits on Sep 11, 2013
  1. Fix regression with context-dependent validations in ActiveResource

    As reported in #348, model#valid? is called with one argument while
    ActiveResource::Validations only defines #valid? without an optional
    The interface of ActiveResouce::Validations#valid? is the same for
    A'resource in Rails 3.2 and the one extracted into a gem.
    Rails 3.2 version:
    Gem version:
    carpodaster committed with mcmire Aug 28, 2013
Commits on Sep 6, 2013
  1. Add have_secure_password matcher

    MDaubs committed with mcmire Aug 18, 2013
Commits on Aug 30, 2013
  1. Remove old version of uniqueness validation matcher specs

    When the `allow_nil` option was introduced, the tests written for it was based
    on an older version of the `validate_uniqueness_of` matcher specs. The tests
    are now in the newer version, located in `spec/shoulda/matchers/active_model`.
    mxie committed Aug 23, 2013
Commits on Aug 23, 2013
  1. Test Rails 4.0 on Travis CI

    MDaubs committed Aug 23, 2013
Commits on Aug 16, 2013
  1. Bump to version 2.4.0.rc1

    mcmire committed Aug 16, 2013
  2. Update NEWS

    mcmire committed Aug 16, 2013
  3. Fix validates_confirmation_of matcher so that it works under Rails 4

    Rails 4 changed how validates_confirmation_of works so that the error
    message is applied to the confirmation attribute, not the original
    mcmire committed Jul 24, 2013
  4. Hook into ActiveSupport::TestCase, not Test::Unit::TestCase

    In Rails 4, ActiveSupport::TestCase no longer inherits from
    Test::Unit::TestCase. In fact, everything uses ActiveSupport::TestCase
    so there is no real reason for us to extend Test::Unit::TestCase.
    mcmire committed Jul 12, 2013
  5. Use 'bundle exec' when creating the Rails app in Cucumber tests

    Now that we are testing against multiple versions of Rails, if you have
    Rails 3 and Rails 4 installed locally then `rails new` will fail.
    mcmire committed Aug 16, 2013
  6. Fix route_matcher specs in Rails 4

    The rails assertion that underlies the `route_matcher` matcher has
    changed in Rails 4 to depend on the `message` method from MiniTest.
    RSpec is smart enough to make that method available, but only for
    controller and routing specs (and only in 2.13.1+).
    I marked the `route_matcher` specs as controller specs and updated the
    rspec-rails gem development dependency to 2.13.1 or later (but less than 3).
    derekprior committed with mcmire May 17, 2013
  7. Fix allow_mass_assignment specs in Rails 4

    This spec has a lot of active_model version checking in it. The version
    checking helpers had to be updated to account for Rails 4.
    I was able to remove the check for active_model 3.0 because 3.0 is now
    the lowest supported rails version.
    derekprior committed with mcmire May 17, 2013
  8. Fix have_db_column_matcher spec for primary key

    You can't redefined the id column in rails 4 without also passing `id:
    false` to the create table statement. Just using a different column name
    for the spec is sufficient for our use here.
    derekprior committed with mcmire May 17, 2013
  9. Use relations to define conditions and order on associations

    In Rails 4, the following construct:
      has_many :children, conditions: { adopted: true }
    changes to:
      has_many :children, lambda { where(adopted: true) }
    As a result, the way we check the conditions attached to a has_many
    changes too: instead of accessing `reflection.options`, we have to use
    `reflection.scope` -- this which refers to the lambda above, so we have
    to evaluate it and then grab the `where` from the Relation that the
    lambda returns.
    mcmire committed May 14, 2013
  10. Refactor AssociationMatcher to use new OptionVerifier

    When using an association matcher you may have qualifiers on that
    matcher which let you make assertions on options passed to the
    association method that you are testing. For instance, has_many has a
    :dependent option and so in order to test this you say something like
        it { should have_many(:people).dependent(:destroy) }
    In order to test such an option we have to compare the option you passed
    with what the actual value of that option is. This is usually obtained
    by looking at the reflection object of the association in question,
    although it can be obtained by other means too.
    Anyway, the code that does this comparison isn't terrible, but there are
    two problems with it. First, it involves typecasting both expected and
    actual values. For instance, this:
        has_many :people, dependent: :destroy
        it { should have_many(:people).dependent(:destroy) }
    should be equivalent to:
        has_many :people, dependent: :destroy
        it { should have_many(:people).dependent('destroy') }
    should be equivalent to:
        has_many :people, dependent: 'destroy'
        it { should have_many(:people).dependent(:destroy) }
    Second, we are a little screwed if the method of obtaining the actual
    value of the option changes depending on which Rails version you're
    So, OptionVerifier attempts to address both of these issues. It's a
    little crazy, but it works.
    I also moved some methods from AssociationMatcher to ModelReflector
    where they really belong.
    mcmire committed Aug 16, 2013
  11. Use `get` instead of `match` in routes

    match is not supported in Rails 4. This still leaves several failures in
    the route_matcher, but these seem to be related to the underlying route
    assertion relying on minitest methods. Need to do more research here...
    derekprior committed with mcmire May 10, 2013