Add Rails 4 Appraisal

Rails 4 includes strong parameters and removed attr_accessible
(protected attributes). I removed the strong_parameters development
dependency and added it to all non-4.0 appraisals. I also added the
'protected_attributes' gem to the 4.0 appraisal because the test suite
examples make heavy use of attr_accessible.
Bump shoulda-context to ~>1.1.2 for Rails 4 compat
Fix render_with_layout_matcher on Rails 4.

Rails 4 moved the layouts ivar from `@layouts` to `@_layouts`.

This change introduces what I have (for now) called the 'RailsShim'. The
idea is that this single class will house the rail version workarounds,
which can then be reused through the code. This paid off here because
both the spec and the implementation need access to the layouts ivar.
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.
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...

https://github.com/rspec/rspec-rails/issues/635
https://github.com/rspec/rspec-rails/issues/679
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.
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.
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.
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.
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).
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.
Don't double install gems to speed up Cucumber tests a bit
Refactor installing gems in Cucumber tests
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.
Fix Cucumber tests to work with Rails 4
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.