1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
Commit graph

4 commits

Author SHA1 Message Date
Elliot Winkler
878e9582e1 Extract a common spec helper
In order to write tests for the `word_wrap` method we have, we need a
spec helper that we can require. We don't need anything fancy. The
doublespeak_spec_helper is doing most of what we want except for the
Doublespeak require.
2015-10-07 23:32:51 -06:00
Elliot Winkler
46bb5d8fab Use doc formatter when running Doublespeak tests 2015-09-29 18:42:08 -06:00
Elliot Winkler
0d43835b61 Fix #permit so #on works and is properly tested
Why:

* When using #permit with the #on qualifier to assert that #permit was
  called on a subset of the params hash (selected using #require), the
  matcher would fail. The matcher didn't properly detect that #permit
  was called on the slice -- it thought it was called on the parent
  params object.
* It turns out this was a bug in Doublespeak. When #require is called,
  we take the subset of the params, which is also an
  ActionController::Parameters object like params, and we stub #permit
  on it at runtime. Unfortunately the Double object created here was
  never activated, so when #permit was called, this Double wasn't the
  one run. Instead, the Double on #permit within the
  ActionController::Parameters class (which is stubbed at the beginning)
  was the one that was run, and it's this object that recorded the call
  on #permit incorrectly.
* This bug slipped through because it turns out when #on was added it
  wasn't tested very well.

To satisfy the above:

* Modify Doublespeak so that when it is in activated mode, whenever
  new doubles are created, activate them immediately.
* Fix all of the tests for #permit around operating on a slice of the
  params hash so that they use the #on qualifier.
2015-09-29 10:29:46 -06:00
Elliot Winkler
878cfbd4cc Make Doublespeak specs runnable without Rails 2015-02-28 23:41:28 -07:00