Commit Graph

26 Commits

Author SHA1 Message Date
Aaron Patterson
1333020448 fixing space errors 2011-01-17 14:45:24 -08:00
Santiago Pastorino
6062d434f1 Allow view in AV::TestCase to access it's controller helpers methods 2011-01-12 12:14:00 -02:00
David Chelimsky
f656796d05 Rename _assigns to view_assigns in AV::TC
- also add tests
- also deprecate _assigns

[#5751 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-03 13:30:31 -02:00
Emilio Tagua
2d274a5208 Use parentheses when using assert_match followed by a regexp to avoid warnings. 2010-09-27 11:19:19 -03:00
Carl Lerche
84d0c30cea Allow view helper's #initialize method to be called. [#5061 state:resolved] 2010-09-13 12:51:42 -07:00
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
David Trasbo
0abf4b0746 Change reference to Test::Unit::AssertionFailedError to the generic ActiveSupport::TestCase::Assertion [#4987 state:commited]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-26 18:45:20 -07:00
David Chelimsky
32b8be9533 Expose view via the view() method in AV::TestCase::Behavior
- was exposed as _view, which suggested it was private
- left _view as an alias of view as not to break any extensions that are
  relying on _view

[#4932 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 17:45:48 +02:00
David Chelimsky
0e0df4b0c5 In ActionView::TestCase::Behavior, assign variables right before
rendering the view.

- Previously, _assigns were locked down the first time _view was
  referenced.

[#4931 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-23 15:07:44 +02:00
David Chelimsky
0576ec4ddd Add support for specifying locals in view tests with assert template [#4927 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-22 14:51:22 +02:00
David Chelimsky
86002a0dfe Support render_template in view tests. Useful for specifying which
partials are rendered under different conditions.

[#4903 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-20 00:26:42 +02:00
David Chelimsky
bdcf70cca8 Memoize the object returned by _view in ActionView::TestCase::Behavior
[#4799 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-08 21:25:31 +02:00
David Chelimsky
d6fec21d1a In AV::TC, move protect_against_forgery? from the test_case to the
_helper module included in the view.

- ensures that protect_against_forgery? is present when a helper
  included in a partial that is rendered by the template under test
  calls it (which happens in FormTagHelper#extra_tags_for_form, for
  example).

[#4700 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-03 23:32:09 +10:00
David Chelimsky
70dca37cfd reorganize tests for AV::TC
- decouple tests from the test case class by moving them outside
- split out more TestCase subs as cleaner way of avoiding bleed of
  class level concepts

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-03 23:32:09 +10:00
David Chelimsky
163152bfd0 Support configuration of controller.controller_path on instances of
ActionView::TestCase::TestController without stubs. Just say:

  @controller.controller_path = "path/i/need/for/this/test"

[#4697 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-26 08:49:57 +02:00
David Chelimsky
8e583b69e8 Move AV::TC to AV::TC::Behavior [#4678 state:resolved]
- enables alternative testing frameworks to include AV::TC::Behavior
  instead of subclassing AV::TC
- also added tests and code for:
  - test view delegates :notice to request.flash
    - useful since generators generate views that use notice
  - test case doesn't try to include modules that are actually
    classes

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 22:58:46 +02:00
Joshua Peek
cdf8c35ffd Consistent routing language 2010-03-30 14:05:42 -05:00
Carlhuda
c8e1cc8657 remove_method is private 2010-03-04 16:35:05 -08:00
wycats
7c785592ec Safely cleans up a test to avoid relying on a particular test order 2010-03-04 15:07:26 -08:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
Yehuda Katz
4cbb9db0a5 For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do
    safe_concat("</form>"), which will skip both the flag set, and the flag
    check.
  * For the first pass, I converted virtually all #html_safe!s to #html_safe,
    and the tests pass. A further optimization would be to try to use
    #safe_concat as much as possible, reducing the performance impact if
    we know up front that a String is safe.
2010-01-31 19:39:13 -08:00
Joshua Peek
2be5e088d2 Use new routing dsl in tests 2009-12-08 16:52:26 -06:00
Chris Hapgood
c2cfb20198 Share ActionView::TestCase's output_buffer with view for concat support.
[#3467 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-07 00:42:07 +01:00
Chris Hapgood
b43964d606 Make some assertions in the ActionView::TestCase tests actually do something.
[#3468 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-07 00:39:39 +01:00
Michael Koziarski
9415935902 Switch to on-by-default XSS escaping for rails.
This consists of:

  * String#html_safe! a method to mark a string as 'safe'
  * ActionView::SafeBuffer a string subclass which escapes anything unsafe which is concatenated to it
  * Calls to String#html_safe! throughout the rails helpers
  * a 'raw' helper which lets you concatenate trusted HTML from non-safety-aware sources (e.g. presantized strings in the DB)
  * New ERB implementation based on erubis which uses a SafeBuffer instead of a String

Hat tip to Django for the inspiration.
2009-10-08 09:31:20 +13:00
Joshua Peek
018b79dd36 File extra test folders into controller, dispatch, or template 2009-10-03 21:05:51 -05:00