Commit Graph

6 Commits

Author SHA1 Message Date
Elliot Winkler 218293ad07 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
2014-04-22 09:37:30 -05:00
John Feminella e8aef07295 Updates RailsShim to be explicit about which Rails pieces it needs 2013-12-16 12:37:33 -05:00
Elliot Winkler a026afb800 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.
2013-08-16 16:17:26 -06:00
Elliot Winkler 2b68f3859b 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.
2013-08-16 16:17:22 -06:00
Derek Prior + Elliot Winkler 9a333d12b4 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.
2013-08-16 16:00:10 -06:00
Derek Prior c4927b73f2 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.
2013-08-16 15:32:08 -06:00