Permalink
Commits on Nov 1, 2013
  1. Remove #for from validation matchers

    Certain classes for validation matchers support a #for method to set the
    attribute that the matcher operates on. This is bad API design, because
    it means that it is possible for a developer to accidentally (or
    purposefully) never call #for and yet still use the matcher (which would
    result in the matcher blowing up). Because of this, the attribute should
    be required in the initializer for the matcher.
    
    Related to this, #allow_value also supports an optional attribute, which
    should be required. Simply moving `.for(...)` to the first argument to
    \#allow_value wouldn't read very well, so we rename it to
    \#allow_value_for. Obviously, this is a backward-incompatible change.
    mcmire committed Nov 1, 2013
  2. 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
    argument.
    
    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:
    https://github.com/rails/rails/blob/3-2-stable/activeresource/lib/active_resource/validations.rb#L123
    
    Gem version:
    https://github.com/rails/activeresource/blob/master/lib/active_resource/validations.rb#L160
    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
    attribute.
    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
    using.
    
    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...
    
    rspec/rspec-rails#635
    rspec/rspec-rails#679
    derekprior committed with mcmire May 10, 2013
  12. Fix set_the_flash_matcher for Rails 4

    The "flashes" instance variable that lives within FlashHash has changed
    in Rails 4. I have added a shim to get the proper name.
    
    Additionally, the set_the_flash matcher will dup the flash hash for the
    controller on which it operates. As #dup does a shallow copy we need to
    make sure to also copy the instance variables within the flash hash when
    we do this. The Rails 4 version of FlashHash has an extra @discard
    variable unlike the Rails 3 version so we make sure to copy that.
    Derek Prior + Elliot Winkler committed with mcmire May 10, 2013