Commit Graph

87 Commits

Author SHA1 Message Date
José Valim e634efca99 Revert usage of safe constantize 2012-01-26 20:48:09 +01:00
Carlos Antonio da Silva 67c96ab024 Move render_to_body logic to return a spaced string to AC::Rendering
This seems to be required only when calling render :partial with an
empty collection from a controller. This call happens to return no
content, letting the response body empty, which means to Rails that it
should go on and try to find a template to render based on the current
action name, thus failing hard.

Although tests keep all green, we need to check a better way to fix
this.
2012-01-17 10:04:38 -02:00
Sergey Nartimov 8c63e7d35d instance_variables method returns symbols in 1.9 ruby 2012-01-07 15:30:05 +03:00
José Valim 501e5b0d7f Merge pull request #3196 from avakhov/patch-am-av-tests-2
Improve tests method for ActionView::TestCase and ActionMailer::TestCase
2011-10-09 02:15:19 -07:00
Alexey Vakhov 8df7fe3f63 normalize arg for ActionView::TestCase tests method 2011-10-03 14:27:42 +04:00
Alexey Vakhov f51cb36fe9 missed underscore in AV::TestCase helper_method documentation 2011-10-03 10:36:13 +04:00
José Valim e8987c30d0 Use safe_constantize where possible. 2011-09-23 16:46:33 +02:00
Josh Kalderimis d182b6ee9c removed deprecated methods, and related tests, from ActionPack 2011-05-24 23:38:59 +02:00
José Valim a93bd11b1d Use remove possible method here. 2011-05-04 19:31:43 +02:00
José Valim 6afc900191 Move prefixes to view paths as they are now a lookup context dependency. 2011-05-04 11:28:37 +02:00
José Valim bebaccdf4a Remove dependency from _template. 2011-05-01 13:40:12 +02:00
Xavier Noria acdbc6ae41 renames response_from_page_or_rjs -> response_from_page, and extracts the RJS in it 2011-04-13 13:24:33 +02:00
Aaron Patterson f975626dc1 test/unit in ruby trunk adds a new instance variable. YAY! 2011-03-08 14:09:44 -08:00
Aaron Patterson 6a8f7f0e04 minitest added @__io__, so we should ignore it too 2011-01-17 14:53:44 -08:00
Santiago Pastorino daada51d10 Reuse the view_context from the controller, this make the test environment more similar to the code applications uses 2011-01-12 16:47:56 -02:00
Santiago Pastorino 6062d434f1 Allow view in AV::TestCase to access it's controller helpers methods 2011-01-12 12:14:00 -02:00
Aaron Patterson a6c42c8267 two argument String#slice is faster than single argument, also avoid creating a Range object 2010-10-03 15:38:17 -07:00
Santiago Pastorino c28bebef13 PERF: Hash[] + map is faster than this silly inject, and var[1..-1] is faster than var.sub('@', '') 2010-10-03 13:34:34 -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
José Valim b951522018 Revert "Perf: refactor _assign method to avoid inject and defining unneeded local var."
_assigns must return a hash.

This reverts commit e66c1cee86.
2010-10-02 08:36:55 +02:00
José Valim 14f9904e0f Avoid (@_var ||= nil) pattern by using initialize methods and ensuring everyone calls super as expected. 2010-09-29 11:18:31 +02:00
Emilio Tagua 8ee27afd06 Don't define _test_case method if already defined. 2010-09-28 15:21:44 -03:00
Emilio Tagua 2f59cd6fd6 Remove method previous method if already defined. 2010-09-27 11:19:23 -03:00
Emilio Tagua 8c97f49f2e Refactor decode_credentials to avoid inject and use map instead.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Emilio Tagua 6d8a6700a7 Perf: refactor _assign method to avoid inject and defining unneeded local var.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -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
Santiago Pastorino b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Piotr Sarnacki a63566dda8 Moved PolymorphicRoutes to ActionDispatch::Routing
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-20 23:12:46 +02:00
Piotr Sarnacki f7ba614c2d Unify routes naming by renaming router to routes
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-02 01:51:03 +02:00
rohit ccb21f20d8 Convert instance_variables to symbols before excluding internal vars [#4965 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 13:27:06 +02: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 f29fb0dd9e update the list of instance variables that are excluded from assigns in view tests
[#4930 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-22 17:15:56 +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
Xavier Noria 207fa59675 Merge remote branch 'rails/master'
Conflicts:
	actionpack/lib/abstract_controller/base.rb
2010-06-20 23:13:19 +02:00
Rizwan Reza ab7830d66c Final touches and fixes. 2010-06-21 00:56:31 +04:30
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 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
Santiago Pastorino aacf2581cd refactor evals and adds some __FILE__ and __LINE__
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-20 15:18:57 +02:00
José Valim 4163ccec23 Clean up the config object in ActionPack. Create config_accessor which just delegates to the config object, reducing the number of deprecations and add specific tests. 2010-04-22 12:00:13 +02:00
wycats 457f7709e9 Missing requires 2010-04-16 21:59:09 -04:00
wycats 3eb97531b8 Refactored url_for in AV to have its own instances of the helpers instead of proxying back to the controller. This potentially allows for more standalone usage of AV. It also kicked up a lot of dust in the tests, which were mocking out controllers to get this behavior. By moving it to the view, it made a lot of the tests more standalone (a win) 2010-04-03 02:44:02 -07:00
Xavier Noria 76f024ac8d adds missing requires for Object#blank? and Object#present? 2010-03-28 14:15:02 +02:00
Carlhuda d9375f3f30 Modify assert_template to use notifications. Also, remove ActionController::Base#template since it is no longer needed. 2010-03-17 16:29:35 -07:00
Carlhuda 6416a35f4b Remove unneeded AV::Base and AV::Template monkey-patches 2010-03-17 14:29:18 -07:00
Carlhuda 947f86c699 Modify assert_template to use instrumentation 2010-03-17 14:29:18 -07:00
Carl Lerche 23b6def0eb Do not always include the named URL helpers into AC::Base and AV::Base. 2010-03-16 15:47:49 -07:00