Commit Graph

1806 Commits

Author SHA1 Message Date
José Valim
59d1c418be Fix a bug where responders were not working properly on method override. 2010-05-24 13:12:40 +02:00
Neeraj Singh
b462952886 Use better assertion methods for testing
[#4645 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-19 10:18:36 +02:00
Neeraj Singh
73f0e1a842 Use assert_respond_to because it has better error messaging
[#4628 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-18 02:12:06 +02:00
José Valim
25f7c030e4 Simplify cookie_store by simply relying on cookies.signed. 2010-05-18 02:05:20 +02:00
wycats
80b60671f7 Revert "Moved encoding work in progress to a feature branch."
This reverts commit ade756fe42423033bae8e5aea8f58782f7a6c517.
2010-05-17 19:41:54 +04:00
Jeremy Kemper
ade756fe42 Moved encoding work in progress to a feature branch.
This reverts commits af0d1a88157942c6e6398dbf73891cff1e152405 and 64d109e3539ad600f58536d3ecabd2f87b67fd1c.
2010-05-16 13:55:29 -07:00
wycats
64d109e353 Significantly improved internal encoding heuristics and support.
* Default Encoding.default_internal to UTF-8
* Eliminated the use of file-wide magic comments to coerce code evaluated inside the file
* Read templates as BINARY, use default_external or template-wide magic comments
  inside the Template to set the initial encoding
  * This means that template handlers in Ruby 1.9 will receive Strings encoded
    in default_internal (UTF-8 by default)
* Create a better Exception for encoding issues, and use it when the template
  source has bytes that are not compatible with the specified encoding
* Allow template handlers to opt-into handling BINARY. If they do so, they
  need to do some of their own manual encoding work
* Added a "Configuration Gotchas" section to the intro Rails Guide instructing
  users to use UTF-8 for everything
* Use config.encoding= in Ruby 1.8, and raise if a value that is an invalid
  $KCODE value is used

Also:
* Fixed a few tests that were assert() rather than assert_equal() and
  were caught by Minitest requiring a String for the message
* Fixed a test where an assert_select was misformed, also caught by
  Minitest being more restrictive
* Fixed a test where a Rack response was returning a String rather
  than an Enumerable
2010-05-16 22:44:43 +04:00
Simon Jefford
f58bdae1f7 Check blocks are not incorrectly detected when compiling erubis templates [#4575 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 15:05:07 +02:00
rohit
fc2480a277 Fixed 1 failure and 2 errors in ActionPack testsuite [#4613 state:commited]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 14:32:53 +02:00
Jeff Kreeftmeijer
fa99de0bd0 partial counters with :as [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 10:32:23 -07:00
Anil Wadghule
2d84f24af5 Add tests for convenience methods #notice and #alert to flash.now [#4369 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 16:52:23 +02:00
Paco Guzman
cdf700147c fix assert_select messages to its declaration behaviour
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 16:31:36 +02:00
David Chelimsky
b3dcbedc67 move assert_template tests to their own test case [#4501 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-03 13:46:34 +02:00
David Chelimsky
849ab92942 Eliminate false positives when passing symbols to assert_template
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-03 13:46:12 +02:00
David Chelimsky
91125f9927 move FixtureResolver to a file that is accessible outside Rails' own tests
[#4522 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
Carl Lerche
6c280f3398 RouteSet does not raise ActionController::RoutingError when no routes match anymore. Instead, it follows the X-Cascade convention. ShowExceptions checks for X-Cascade so that the routing error page can still be displayed. 2010-04-30 16:40:42 -07:00
rick
8d236ccb84 add HTTP Token Authorization support to complement Basic and Digest Authorization. 2010-04-30 07:46:30 -07:00
Neeraj Singh
d793d30776 ActionCachingTestController rescues from all exceptions. Making sure that all the tests check for valid response. [#4468 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-29 12:48:34 +02:00
Anil Wadghule
53c13f1aca Use Config::CONFIG['host_os'] instead of RUBY_PLATFORM [#4477 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-26 11:12:52 -07:00
Cezary Baginski
490a3335d5 Action Pack: fix tests with -K*, work around Ruby 1.9.1 constant lookup.
[#4473 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-25 17:00:20 -07:00
Jeremy Kemper
df886c4c89 Missed commit: explicit source encoding 2010-04-24 18:52:51 -07:00
José Valim
aaaa1782b4 Fix render :xml test (ht Simo Niemelä) 2010-04-24 11:48:47 +02:00
Santiago Pastorino
920df0a475 Make ActionDispatch url_for use HWIA symbolize_keys
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-22 09:06:55 -07:00
J Smith
275e839b8d Ensure that url_for uses symbolized keys in the controller. [#4391]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-22 16:47:36 +02:00
José Valim
81fb742488 Always downstream given options in :json, :xml and :js renderers and add tests for it. 2010-04-22 12:12:38 +02:00
David Chelimsky
4327ad51ab access assigns as a method or hash, with strings or symbols [#4431 state:resolved] 2010-04-17 15:59:10 -04:00
Santiago Pastorino
e85100da0a Added missing require 2010-04-16 23:44:39 -03:00
Santiago Pastorino
5699de1d15 Added test get to js should have a header with content-type text/javascript 2010-04-16 11:03:16 -03:00
Santiago Pastorino
8a8da68d1f Tidy up a bit this test file 2010-04-16 11:03:16 -03:00
Santiago Pastorino
462a7b45f6 Revert "Add test case which check content type when rendering rjs" partial in html template" rendering rjs in html doesn't make sense, it would just output javascript into the template, no script tag
This reverts commit dc251389d1ab4303b80a22642f4241940b73cbe7.
2010-04-16 11:03:16 -03:00
Santiago Pastorino and Carl Lerche
0ea434e2f4 Make perform_caching work again, with the tests passing and backward compatible 2010-04-15 18:25:08 -03:00
wycats
8e9df34fa3 Merge branch 'master' of github.com:rails/rails 2010-04-13 14:07:46 -07:00
Stanko Alexander
dc251389d1 Add test case which check content type when rendering rjs partial in html template
Signed-off-by: wycats <wycats@gmail.com>
2010-04-13 13:09:41 -07:00
Anil Wadghule
518891f490 Use correct RUBY_PLATFORM regex for Windows env [#4385 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-13 12:39:03 -07:00
José Valim
ece157e950 Move verification to a plugin as well: http://github.com/rails/verification.git 2010-04-10 11:47:20 +02:00
Carl Lerche
99d5459921 Fixed that default locale templates should be used if the current locale template is missing [DHH] 2010-04-08 18:11:26 -07:00
Michael Koziarski
82514c2897 Add accessors for request and response so tests don't have to mess with internal ivars 2010-04-09 11:30:39 +12:00
Joshua Peek
570c54c39a Fix cookie access in integration tests with other host names 2010-04-05 15:22:09 -07:00
José Valim
6690d66292 Rename config.cookie_secret to config.secret_token and pass it as configuration in request.env. This is another step forward removing global configuration. 2010-04-05 12:00:24 +02:00
wycats
ab8bf9e152 * Change the object used in routing constraints to be an instance of
ActionDispatch::Request rather than Rack::Request.

* Changed ActionDispatch::Request#method to return a String, to be
  compatible with the Rack::Request superclass.

* Changed ActionDispatch::Request#method to return the original
  method in the case of methodoverride and #request_method not to,
  to be compatible with Rack::Request
2010-04-03 20:24:30 -07:00
José Valim
62151dd272 Deprecate cookie_verifier_secret in favor of config.cookie_secret allowing signed cookies to work again. 2010-03-31 12:59:41 +02:00
Joshua Peek
cdf8c35ffd Consistent routing language 2010-03-30 14:05:42 -05:00
Joshua Peek
17f0c1e9e8 Fix stack overflow bug in integration test router helpers 2010-03-30 13:58:18 -05:00
Rizwan Reza
167017f655 Tests method_missing to raise NameError. [#2522 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 00:26:44 -07:00
wycats
15c31c7639 open_session can just return the a dup of the current context.
At this point, its entire purpose in the open_session {} case was to
delegate back to the IntegrationTest anyway.
2010-03-22 17:14:28 -07:00
José Valim
13bb4a6e68 Current url helpers become actions in controller. Added a failing test case for it. 2010-03-22 23:57:06 +01:00
wycats
e1c030edd8 Fixed a bunch of tests that failed in 1.9 because they assumed that a Rack response was a String. 2010-03-19 18:46:29 -07:00
José Valim
f28d856cec Improve performance of the rendering stack by freezing formats as a sign that they shouldn't be further modified. 2010-03-19 17:20:20 +01:00
Santiago Pastorino
e629e21135 remove duplicated self.view_paths assingment on controller tests [#4206 state:commited]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-18 17:50:28 -07:00
Carlhuda
1dacc19702 Return a valid Rack response from bare ActionController::Metal 2010-03-18 17:32:53 -07:00
Carlhuda
edb5991a14 Make render :partial, :layout consistent between AC and AV 2010-03-18 16:55:32 -07:00
Carlhuda
71c9337f45 All tests pass without memoizing view_context 2010-03-18 15:52:43 -07:00
Mathias Biilmann Christensen
c8dd6f224c Deleting and setting a cookie in the same request was broken
Made sure to remove a cookie from @deleted_cookies when set

[#4211 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-17 18:04:32 -07: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
José Valim
56fb60ebfe Fix rendering of HTML partials inside JS templates [#4197 status:resolved] 2010-03-16 23:36:29 +01:00
Carlhuda
c61ed70b00 Some more tweaks on <% %>.
* The cache helper is now semantically "mark this region for caching"
  * As a result, <% x = cache do %> no longer works
2010-03-16 11:43:04 -07:00
Jeremy Kemper
b65b989725 Break a window :/ 2010-03-15 23:49:35 -07:00
Carlhuda
9de83050d3 Add deprecation notices for <% %>.
* The approach is to compile <% %> into a method call that checks whether
    the value returned from a block is a String. If it is, it concats to the buffer and
    prints a deprecation warning.
  * <%= %> uses exactly the same logic to compile the template, which first checks
    to see whether it's compiling a block.
  * This should have no impact on other uses of block in templates. For instance, in
    <% [1,2,3].each do |i| %><%= i %><% end %>, the call to each returns an Array,
    not a String, so the result is not concatenated
  * In two cases (#capture and #cache), a String can be returned that should *never*
    be concatenated. We have temporarily created a String subclass called NonConcattingString
    which behaves (and is serialized) identically to String, but is not concatenated
    by the code that handles deprecated <% %> block helpers. Once we remove support
    for <% %> block helpers, we can remove NonConcattingString.
2010-03-15 14:50:43 -07:00
Andrew White
96bc6bcfee Don't force singularization of singleton resource names, e.g. /preferences [#4089 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2010-03-15 09:45:29 -05:00
Jeremy Kemper
16572fd46e read_ and write_fragment cache preserve html safety yet cache strings only 2010-03-14 19:09:32 -07:00
José Valim
4ba334c0f4 Ensure controller filters are executed before stuff starts to happen. 2010-03-13 21:28:34 +01:00
José Valim
6c027443b0 Add tests for lookup context. 2010-03-11 13:23:14 +01:00
Joshua Peek
dcd110c724 skip_relative_url_root url_for option is dead 2010-03-09 21:25:09 -06:00
Joshua Peek
4d2470f7da RouteSet#rewrite => url_for 2010-03-09 21:00:24 -06:00
Joshua Peek
7db80f87e9 Move AC::UrlRewriter onto route set 2010-03-09 20:50:35 -06:00
Justin Ko
ea4f8ef33f Reinstate dom_id in controllers.
[#3040 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-09 10:49:36 -08:00
wycats
de79525d04 Get rid of the instance-level URL rewriter 2010-03-09 10:20:56 -08:00
Jeremy Kemper
c507e16dba Reinstate default_url_options and remove url_options= writer 2010-03-08 21:40:45 -08:00
José Valim
8f082ff421 Clean LookupContext API. 2010-03-08 23:25:16 +01:00
Carlhuda
900a2d304a Get rid of relative_url_path in favor of respecting SCRIPT_NAME. Also added a way to specify a default SCRIPT_NAME when generating URLs out of the context of a request. 2010-03-04 17:43:46 -08:00
Carlhuda
ff29606c06 Refactor cache_store to use ActionController config 2010-03-04 16:50:57 -08:00
Carlhuda
e311622e7b Deprecated ActionController::Base.session_options= and ActionController::Base.session_store= in favor of a config.session_store method (which takes params) and a config.cookie_secret variable, which is used in various secret scenarios. The old AC::Base options will continue to work with deprecation warnings. 2010-03-04 16:05:52 -08:00
Jeremy Kemper
5e3e5ac12b Clarify cookie jar test 2010-03-04 15:31:28 -08:00
wycats
70916f6a9c Fixes test ordering bug (ht: evan) 2010-03-04 12:21:12 -08:00
Carl Lerche
5ce25aecee Merge branch 'configuration_refactor' 2010-03-03 22:35:43 -08:00
Carl Lerche
18bcce596e ActionController::Base.use_accept_header is not actually used anymore, so let's deprecate it. 2010-03-03 21:24:00 -08:00
Carl Lerche
fb14b8c6fd ActionDispatch::Request deprecates #request_uri
* Refactored ActionPatch to use fullpath instead
2010-03-03 21:24:00 -08:00
Carl Lerche
eb49bd6949 Fix tests for the request refactor 2010-03-03 21:24:00 -08:00
Carlhuda
5e0a05b8cb Tweak the semantic of various URL related methods of ActionDispatch::Request 2010-03-03 21:23:34 -08:00
Yehuda Katz
2a60cc6822 don't depend on the order of cookies (Hash ordering bug) 2010-03-03 16:07:23 -08:00
Carlhuda
bcfb77782b Work on deprecating ActionController::Base.relative_url_root 2010-03-03 15:49:52 -08:00
Carlhuda
bf9913f8f4 Move session_store and session_options to the AC configuration object 2010-03-03 15:49:52 -08:00
Carlhuda
d78e3fe73f Fix failing Action Pack tests 2010-03-02 14:41:12 -08:00
Jeremy Kemper
9f83cdc38e No longer add missing leading / on path args to assert_redirected_to. Deprecated in 2.3.6. 2010-03-02 14:16:25 -08:00
Jeremy Kemper
ecfd6d90ee Action Mailer setup obviated by test bundle 2010-03-02 13:54:59 -08:00
Joshua Peek
7317d9ef4c Remove implicit controller namespacing from new dsl 2010-02-28 16:39:01 -06:00
Carlhuda
4bdc783d37 1.9 seems to have a bug involving cloned classes and super. Fix it by not cloning (and instead creating classes on demand). The 1.9 bug should be investigated. 2010-02-26 18:25:56 -08:00
Carlhuda
050831803a If IntegrationSession is initialized with an objects that responds to #routes, automatically extend the URL helpers from the RouteSet onto it 2010-02-26 17:18:45 -08:00
Carlhuda
ab0cc7286f Setting UrlFor in with_routing is no longer needed now that it's not global 2010-02-26 15:56:38 -08:00
Carlhuda
47fe14bfcc Silence test deprecation warnings 2010-02-26 15:34:12 -08:00
Carlhuda
98f77e0827 Rename named_url_helpers to url_helpers and url_helpers to url_for 2010-02-26 15:04:50 -08:00
José Valim
bd36418c51 Fix controller_path returnsing an empty string in Ruby 1.8.7 [#4036 status:resolved] 2010-02-26 11:51:21 +01:00
Carlhuda
f863045c45 Rename metaclass to singleton_class 2010-02-25 17:56:58 -08:00
Carlhuda
8760add31a Get URL helpers working again in integration tests. 2010-02-25 17:53:30 -08:00
Carlhuda
36fd9efb5e Continued effort to deglobalize the router 2010-02-25 17:53:01 -08:00
Carlhuda
a278f23310 Fix all of AP's tests with the non global router 2010-02-25 17:53:01 -08:00
Carlhuda
4b038f638d Merge branch 'master' of github.com:rails/rails 2010-02-25 17:53:01 -08:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
José Valim
a39c7505bd Cleanup render callstack and make render(:json => {}, :status => 401) work again. 2010-02-24 22:17:25 +01:00
Carl Lerche
6a061187e2 Remove ActionController::Base.resources_path_names 2010-02-24 10:52:16 -08:00
Yehuda Katz
ae933a093d Fix render :file => "#{Rails.root}/public/404.html", :status => :not_found. Closes #8994 2010-02-23 22:45:42 -08:00
Carlhuda
24ab5665b2 Revert "Fix test load paths for those not using bundler"
This reverts commit eec2d301d4ce9df9c71c1a5aa63053eb970b6818.

This commit broke tests. You cannot have a file called "bundler" on the load path.
2010-02-23 17:31:17 -08:00
Carlhuda
5e2bd08023 Makes send_file work again by deferring to Rack::Sendfile.
* Add the Rack::Sendfile middleware
  * Make the header to use configurable via config.action_dispatch.x_sendfile_header (default to "X-Sendfile"). 
  * Add Railties tests to confirm that these work
  * Remove the :stream, :buffer_size, and :x_senfile default options to send_file
  * Change the log subscriber to always say "Sent file"
  * Add deprecation warnings for options that are now no-ops

Note that servers can configure this by setting X-Sendfile-Type. Hosting companies and those creating packages of servers specially designed for Rails applications are encouraged to specify this header so that this can work transparently.
2010-02-23 17:06:35 -08:00
Carlhuda
3345af61fb Fix streaming by having it create a File object, which can be handled by Rack servers as appropriate 2010-02-23 15:37:17 -08:00
Martin Schürrer
6bc24d40d5 Use ActionDispatch::Routing everywhere 2010-02-21 13:43:51 -08:00
José Valim
250c809246 Require persisted? in ActiveModel::Lint and remove new_record? and destroyed? methods. ActionPack does not care if the resource is new or if it was destroyed, it cares only if it's persisted somewhere or not. 2010-02-21 11:12:14 +01:00
snusnu
f81c6bc040 AMo #key is now #to_key and CI is probably happy
Obviously #key is a too common name to be included
in the AMo interface, #to_key fits better and also
relates nicely to #to_param. Thx wycats, koz and
josevalim for the suggestion.

AR's #to_key implementation now takes customized
primary keys into account and there's a testcase
for that too.

The #to_param AMo lint makes no assumptions on how
the method behaves in the presence of composite
primary keys. It leaves the decision wether to
provide a default, or to raise and thus signal to
the user that implementing this method will need
his special attention, up to the implementers. All
AMo cares about is that #to_param is implemented
and returns nil in case of a new_record?.

The default CompliantObject used in lint_test
provides a naive default implementation that just
joins all key attributes with '-'.

The #to_key default implementation in lint_test's
CompliantObject now returns [id] instead of [1].
This was previously causing the (wrong) tests I
added for AR's #to_key implementation to pass. The
#to_key tests added with this patch should be
better.

The CI failure was caused by my lack of knowledge
about the test:isolated task. The tests for the
record_identifier code in action_controller are
using fake non AR models and I forgot to stub the
#to_key method over there. This issue didn't come
up when running the test task, only test:isolated
revealed it. This patch fixes that.

All tests pass isolated or not, well, apart from
one previously unpended test in action_controller
that is unrelated to my patch.
2010-02-20 20:17:29 -08:00
Carlhuda
a3c6ad7d5e Fix a bunch of pending tests by providing an introspection mode for the Response object that does up-front parsing of the headers to populate things like @etag 2010-02-19 19:19:20 -08:00
Joshua Peek
7d7f9ccfdf Reinstate pending tests that were supposed to be fixed before the
beta.

Shout louder this time so they actually get fixed.
2010-02-19 09:34:22 -06:00
José Valim
3f948a0e29 Merge master. 2010-02-17 00:48:04 +01:00
José Valim
e8ef12e39d Make Railties tests green again. 2010-02-17 00:14:49 +01:00
José Valim
b1edd09662 Ensure render :text => resource first tries to invoke :to_text on it 2010-02-16 23:26:29 +01:00
Prem Sichanugrist
f0523f72b4 Rename Rails::Subscriber to Rails::LogSubscriber 2010-02-16 22:36:15 +01:00
Joshua Peek
eec2d301d4 Fix test load paths for those not using bundler 2010-02-15 10:20:11 -06:00
Yehuda Katz
5384df5589 Updates subscriber test for new output 2010-02-05 22:48:13 -08:00
Jeremy Kemper
31f8a59c16 Test that csrf meta content is html-escaped, too 2010-02-04 18:03:06 -08:00
Jeremy Kemper
6bf79f02be Revert dumb test 2010-02-04 17:49:23 -08:00
Jeremy Kemper
3062bc70ef HTML-escape csrf meta contents 2010-02-04 17:45:43 -08:00
Jeremy Kemper
2191aa47ac Expose CSRF param name also 2010-02-04 15:26:24 -08:00
Jeremy Kemper
78de17cf70 Expose CSRF tag for UJS adapters 2010-02-04 14:58:32 -08:00
Jeremy Kemper
e5ab4b0d07 Convert to class_attribute 2010-02-01 02:02:42 -08:00
Yehuda Katz
2092351652 Add support for compile-time <%= raw %> 2010-01-31 23:42:35 -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
Mikel Lindsaar
2ebea1c02d deOMGifying Railties, Active Support, and Action Pack 2010-01-31 09:46:30 -08:00
José Valim
b3a028259f Improve missing template error messages a little bit. 2010-01-31 10:24:38 +01:00
Joshua Peek
9c2c307ee4 Move form_remote_tag and remote_form_for into prototype_legacy_helper 2010-01-30 15:42:30 -06:00
José Valim
c164ca1efb Bring helpers_dir deprecation back. 2010-01-30 16:49:58 +01:00
José Valim
ba82eb2efa Get rid of AM warnings in AP test suite. 2010-01-29 17:51:05 +01:00
José Valim
3f84091937 ActionMailer should depend just on AbstractController. 2010-01-29 17:51:05 +01:00
José Valim
dc57d545bb Fix t('.helper'). 2010-01-26 20:43:35 +01:00
José Valim
49be3316c2 Add a deprecation for helpers_dir. 2010-01-25 23:38:47 +01:00
José Valim
6545a68264 Fix failing tests after merge. 2010-01-24 15:08:06 +01:00
José Valim
fc4f237864 Make filter parameters based on request, so they can be modified for anything in the middleware stack. 2010-01-21 16:52:49 +01:00
José Valim
378464a2e4 Default to sync instrumentation. 2010-01-21 13:09:12 +01:00
José Valim
31fddf2ace Tidy up new filter_parameters implementation. 2010-01-21 11:57:24 +01:00
Prem Sichanugrist
b1bc3b3cd3 Add deprecation warning for calling filter_parameter_logging ActionController::Base, and allow it to be configured in config.filter_parameters
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-21 11:41:31 +01:00
José Valim
6e26be6960 Move ActionController::Translation to AbstractController::Translation. 2010-01-20 15:02:13 +01:00
Yehuda Katz
1a50d2e66a Stop overriding LoadError.new to return a MissingSourceError (and sometimes nil!) 2010-01-19 22:35:26 -08:00
José Valim
a8e25a518a Move parameters to the top on logging. 2010-01-19 15:35:24 +01:00
José Valim
5a81dbf489 Fix failing test. 2010-01-19 15:35:23 +01:00
Joshua Peek
c29bb8857e Clear out AS callback method pollution in AC::Base.action_methods 2010-01-17 22:06:28 -06:00
Joshua Peek
eeba755a11 Accessing nonexistant cookies through the signed jar should not raise an
exception
2010-01-17 21:31:06 -06:00
Sam Elliott and Santiago Pastorino
5a6596787b Module lookup issue on flash_test using ruby 1.9 solved [#3716 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-01-17 16:57:14 +01:00
José Valim
27d9836ad3 Add ActionDispatch::Railties::Subscriber and finish tidying up the logging. 2010-01-17 12:43:17 +01:00
José Valim
645832cfdd Clean up filter parameter logging tests. 2010-01-17 09:54:24 +01:00
Joshua Peek
d2d4acf027 Cookies middleware 2010-01-16 17:22:27 -06:00
Joshua Peek
ead93c5be5 Move Flash into middleware 2010-01-15 14:55:13 -06:00
Joshua Peek
3eaf525213 Make HEAD method masquerade as GET so requests are routed correctly 2010-01-15 12:38:50 -06:00
José Valim
8b9bff9557 Small tweaks in ActionController subscriber messages format. 2010-01-15 12:24:31 +01:00
José Valim
8c8942ed4f Move Dispatcher setup to Railties and add instrumentation hook. 2010-01-15 12:24:30 +01:00
Joshua Peek
be968ecd8b Respect resources_path_names and :path_names options in new dsl 2010-01-13 20:26:01 -06:00
Joshua Peek
0f51e45307 optimise_named_routes is unnecessary 2010-01-13 20:22:53 -06:00
José Valim
f921ad5c97 Tidy up ActiveRecord and Views runtime information on process action logger. 2010-01-14 01:07:03 +01:00
José Valim
01839834fd ControllerRuntime tests also use Rails::Subscriber::TestHelper. 2010-01-13 01:19:24 +01:00
José Valim
b0d35ad00c Test fragment/page cache and send data/file notifications. 2010-01-13 01:19:24 +01:00
José Valim
da5978c223 Add subscriber for ActionPack and move all logging inside it. 2010-01-13 01:19:23 +01:00
José Valim
d2e7c1b97d Raise an error if respond_with is invoked and no format is declared. 2010-01-10 20:21:08 +01:00
José Valim
3b631df101 Ensure that segments in default_url_options also work with format specified. 2010-01-07 17:17:06 +01:00
José Valim
f149eb19d4 From now on, parameters defined in default_url_options can be absent from named routes.
This allows the following setup to work:

  # app/controllers/application_controller.rb
  class ApplicationController
    def default_url_options(options=nil)
      { :locale => I18n.locale }
    end
  end

  # From your views and controllers:
  I18n.locale                 #=> :en
  users_url                   #=> "/en/users"
  users_url(:pl)              #=> "/pl/users"
  user_url(1)                 #=> "/en/users/1"
  user_url(:pl, 1)            #=> "/pl/users/1"
  user_url(1, :locale => :pl) #=> "/pl/users/1"

If you provide all expected parameters, it still works as previously.
But if any parameter is missing, it tries to assign all possible ones
with the hash returned in default_url_options or the one passed straight
to the named route method.

Beware that default_url_options in ApplicationController is not shared
with ActionMailer, so you are required to always give the locale in your
email views.
2010-01-07 15:34:14 +01:00
José Valim
f564f947d9 Remove duplicated url_for code and move methods shared between ActionMailer and ActionController up to AbstractController. 2010-01-07 15:31:50 +01:00
José Valim
bd729344a7 Remove deprecated formatted named routes 2010-01-04 23:05:27 +01:00
José Valim
f2d276fefd Ensure no notification is on the queue before running notifications related tests. 2010-01-03 23:39:09 +01:00
José Valim
6fbe9ef2ff Use namespaces in notifications. 2010-01-03 20:39:42 +01:00
Jeremy Kemper
db49b7dc94 Fix new year heisenbug 2009-12-31 18:32:16 -08:00
José Valim
75ba102a80 Remove ActionView inline logging to ActiveSupport::Notifications and create ActionController::Base#log_event, so everything can be logged within one listener. Also expose log_process_action as a hook for different modules to include their own information during the action processing. This allow ActiveRecord to hook and any other ORM. Finally, this commit changes 'Processing' and 'Rendering' in logs to 'Processed' and 'Rendered' because at the point it's logged, everying already happened. 2009-12-26 20:28:53 +01:00
Joshua Peek
a1bf2f96ce AD::StatusCodes support is now part of rack 2009-12-22 16:08:03 -06:00
David Heinemeier Hansson
fee07b9da0 Merge branch 'master' of github.com:rails/rails 2009-12-21 15:50:19 -08:00
Joshua Peek
f82e1046f8 reset_session needs to be a real method so flash can override it 2009-12-21 17:29:59 -06:00
David Heinemeier Hansson
c06aff0a7e Added cookies.permanent, cookies.signed, and cookies.permanent.signed accessor for common cookie actions [DHH] 2009-12-20 14:33:13 -08:00
David Heinemeier Hansson
fa575973b1 Added alert/notice from 2-3-stable and refactored redirect_to into just living in Redirector [DHH] 2009-12-17 16:37:11 -08:00
Joshua Peek
5f8e48cbd2 Move route reloading into railties 2009-12-14 17:54:41 -06:00
Joshua Peek
ce970a8bb9 Remove route loading tests since it should be tested by railties 2009-12-14 16:52:22 -06:00
Joshua Peek
ee395fe626 TestProcess belongs in AD 2009-12-12 18:09:44 -06:00
Joshua Peek
588225f885 Remove fancy method not allowed resource exceptions since they are
too much of a hack
2009-12-11 00:01:22 -06:00
Joshua Peek
2f90d70049 Kill RouteSet#recognize 2009-12-10 23:45:04 -06:00
Yehuda Katz
8b9275340f Merge branch 'master' of github.com:rails/rails 2009-12-10 13:11:15 -08:00
Carlhuda
f9d570bdd8 Simpler RenderOption API -- removes the need for registering the types and extending a module 2009-12-09 13:40:49 -08:00
Joshua Peek
9fbde11b8b More test porting 2009-12-08 17:41:00 -06:00
Joshua Peek
2be5e088d2 Use new routing dsl in tests 2009-12-08 16:52:26 -06:00
José Valim
2ecfa817c9 Responder redirects to resource if destroy fails.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2009-12-07 15:05:27 -08:00
Joshua Peek
48127c637c Deprecate recalling generation params when the defaults are nil 2009-12-06 20:40:07 -06:00
Joshua Peek
4663f75f6b Update rackmount to fix some pending tests 2009-12-05 13:10:00 -06:00
Carlhuda
c1304098cc Reorganize autoloads:
* A new module (ActiveSupport::Autoload) is provide that extends
    autoloading with new behavior.
  * All autoloads in modules that have extended ActiveSupport::Autoload
    will be eagerly required in threadsafe environments
  * Autoloads can optionally leave off the path if the path is the same
    as full_constant_name.underscore
  * It is possible to specify that a group of autoloads live under an
    additional path. For instance, all of ActionDispatch's middlewares
    are ActionDispatch::MiddlewareName, but they live under 
    "action_dispatch/middlewares/middleware_name"
  * It is possible to specify that a group of autoloads are all found
    at the same path. For instance, a number of exceptions might all
    be declared there.
  * One consequence of this is that testing-related constants are not
    autoloaded. To get the testing helpers for a given component,
    require "component_name/test_case". For instance, "action_controller/test_case".
  * test_help.rb, which is automatically required by a Rails application's
    test helper, requires the test_case.rb for all active components, so
    this change will not be disruptive in existing or new applications.
2009-12-02 20:01:08 -08:00
Joshua Peek
4dee277a9b Stop escaping "[]" in query string 2009-12-02 12:46:14 -06:00
Jeremy Kemper
de40bc033a Ensure Cache-Control max-age is an integer 2009-12-02 03:23:00 -08:00
Joshua Peek
7fe19d415a Make recognize try to constantize controller to see if it exists 2009-12-01 22:22:48 -06:00
Joshua Peek
44587b7fae Merge branch 'master' of github.com:rails/rails 2009-12-01 14:53:39 -06:00
Joshua Peek
61a31f3d3d Fix generating params with optional defaults [#3404 state:resolved] 2009-12-01 14:52:19 -06:00
Jeremy Kemper
0c4990b5f4 Fix caching test to ensure notifications are all delivered 2009-12-01 12:19:42 -08:00
José Valim
6e30361260 Allow ActionController::Responder to have a common entry point for all formats.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2009-12-01 08:23:43 -08:00
Jeremy Kemper
4f2a04cc08 Notifications: extract central Notifier, cordon off the internal Fanout implementation, and segregate instrumentation concerns 2009-11-28 12:50:09 -08:00
Joshua Peek
59dbae145b Privatize Routing.possible_controllers and fix brittle url helper
controller test loading.
2009-11-23 21:50:21 -06:00
Joshua Peek
350d3daa88 Remove inflection reloads routes test 2009-11-23 19:25:39 -06:00
Jeremy Kemper
f8d06e62a9 Pending test now passing 2009-11-23 14:07:54 -08:00
Joshua Peek
6e67f88a11 Extended and case insensitive regexp routes aren't that important.
Mark them as pending till I figure it out.
2009-11-19 17:58:57 -08:00
Jeremy Kemper
0dfd993e77 Fix test bleed 2009-11-18 17:54:27 -08:00
Jeremy Kemper
e1385be025 Extract form_authenticity_param instance method so it's overridable in subclasses 2009-11-17 23:40:06 -08:00
José Valim
2cb47c742f Split mime responder into smaller chunks and allow action to be configured.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-11-13 09:52:52 -08:00
Jeremy Kemper
8cd486da80 test-unit 2 compat: assert_raise doesn't support regexp second arg to match exception message 2009-11-10 16:14:10 -08:00
Joshua Peek
e9d21ca903 Add pending test for generating routes with optional params that recall last
request
2009-11-09 22:18:51 -06:00
Joshua Peek
763489ce06 Add pending test for route generation with default param 2009-11-09 21:54:50 -06:00
Xavier Noria
1979e9c855 Symbol#to_proc is not needed for Ruby >= 1.8.7 2009-11-09 22:16:51 +01:00
Jeremy Kemper
a8ed10546d Ruby 1.9: don't assume params are US-ASCII. Hands off the encoding. 2009-11-04 16:27:54 -08:00
Jeremy Kemper
425a02cece Ruby 1.9: resolve constant lookup issues 2009-11-04 15:41:50 -08:00
Jeremy Kemper
0ff8f81adc Ruby 1.9: more constant lookup badness :( 2009-11-04 15:00:19 -08:00
José Valim
2d514e5352 Move some of helper tests to AbstractController. 2009-11-01 02:23:48 +01:00
Yehuda Katz
51c24ae3e3 Caching refactoring 2009-10-29 00:44:12 -04:00
Joshua Peek
759f2ccc4c Start migrating AC routing tests into dispatch folder 2009-10-27 21:02:20 -05:00
Yehuda Katz
2bdd8fa863 Clean up parameter logging some 2009-10-26 21:31:37 -07:00
Yehuda Katz
000d593621 Clean up and update cookies 2009-10-26 18:01:09 -07:00
Yehuda Katz
e1786ee6eb Fixes expires_now and cleans things up a bit 2009-10-26 17:32:42 -07:00
Joshua Peek
a5c82a9dfb Start rewriting some internal tests to use the new routing dsl 2009-10-20 16:03:55 -05:00
Joshua Peek
a1ce52effc New routing dsl 2009-10-20 12:31:23 -05:00
Joshua Peek
df68cae0c0 Group together all the old routing dsl logic 2009-10-20 10:46:27 -05:00
Joshua Peek
a74022ecd3 Move Routing into AD 2009-10-20 10:14:46 -05:00
Joshua Peek
3895e2ccb3 Donate tests I wrote for rackmount rails integration 2009-10-20 09:52:59 -05:00
Joshua Peek
a1df259074 Replace decaying routing internals w/ rack-mount 2009-10-19 23:32:17 -05:00
Joshua Peek
6c581f5fd5 Kill routing tests expecting path to be unescaped. Most rack servers already escape PATH_INFO. 2009-10-19 22:42:11 -05:00
Jeremy Kemper
acb1624f27 Merge commit 'josevalim/fixes'
Conflicts:
	railties/test/generators/app_generator_test.rb
2009-10-19 18:37:19 -07:00
Joshua Peek
91726c201b Relax generation requirements and only enforce the requirements used in the path segment 2009-10-18 11:05:24 -05:00
Joshua Peek
6873b1d658 Don't use use_controllers in routing tests 2009-10-18 00:26:36 -05:00
Joshua Peek
2c3ca9ae80 This is routing error message test is tightly coupled to the implementation. Just test that it raises an exception. 2009-10-17 21:56:43 -05:00
Joshua Peek
f1767c1513 Drop legacy support for case insensitive controller recognition 2009-10-17 21:21:34 -05:00
Joshua Peek
cc0103fe83 Fix brittle query string comparisons 2009-10-17 19:18:18 -05:00
Joshua Peek
e900a8437a Fix brittle query string comparisons 2009-10-17 17:35:21 -05:00
Joshua Peek
702df0d238 Fix standalone run of routing test. Only reference controllers that are provided in fake_controllers 2009-10-17 17:35:21 -05:00
Joshua Peek
6c2a73909e Stop using with_controllers in tests 2009-10-17 17:35:20 -05:00
Joshua Peek
e00f57e208 No longer need this special routing exception message because these kinds of ambiguous generations are deprecated 2009-10-17 17:35:20 -05:00
Joshua Peek
20f0b33035 Drop support for routing :generate_all 2009-10-17 17:35:20 -05:00
Joshua Peek
d50413826f Invalid route requirements should always raise an exception even if they are unused 2009-10-17 17:35:19 -05:00
José Valim
2e37effd72 Unify class_inheritable_accessor and extlib_inheritable_accessor and allow responder to be set in the class level. 2009-10-17 12:54:03 -03:00
Jeremy Kemper
71f7e75d95 Merge branch 'master' into orchestra 2009-10-15 17:36:54 -07:00
Yehuda Katz
c44d560145 Rack responses need to wrap Strings in 1.9 2009-10-15 16:37:27 -07:00
Yehuda Katz
e9d6bcd19f Update MetalTest for constant scoping change in 1.9 2009-10-15 16:33:47 -07:00
Yehuda Katz
4869b74aee Fix test to correctly handle 1.9 Array#to_s behavior 2009-10-15 16:27:26 -07:00
José Valim
2d7abe245e Renamed Orchestra to Notifications once again [#3321 state:resolved] 2009-10-15 18:51:51 -03:00
José Valim
8f59d7a8d8 Instrument cache store events only if required. 2009-10-15 18:19:24 -03:00
José Valim
af0d1fa892 Update Orchestra instrumentations and move part of logging to Orchestra. 2009-10-15 18:18:44 -03:00
José Valim
8b340ab2f6 Revert "Rename Orchestra to Notifications [#3321 state:resolved]"
This reverts commit 8cbf825425dc8ad3770881ea4e100b9023c69ce2.
2009-10-15 18:06:15 -03:00
Jeremy Kemper
c09a5ffea7 Merge branch 'arel' 2009-10-14 19:32:09 -07:00
Jeremy Kemper
6eee1dd62c Clarify AR dependency 2009-10-14 19:31:29 -07:00
Joshua Peek
8cbf825425 Rename Orchestra to Notifications [#3321 state:resolved] 2009-10-14 19:50:36 -05:00
George Ogata
3de8b44b26 Make IntegrationTest::Runner propagate method_missing to ancestors.
Fixes RSpec integration example groups, which mixes its Matchers
module into ActiveSupport::TestCase.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-10-15 11:01:42 +13:00
Craig Smith
316f4704ea Test cases should see all the cookies, not just cookies that have been set in the controller.
Previously this example would always pass, even when cookies.delete was not called.

@request.cookies['foo'] = 'bar'
get :delete_cookie
assert_nil cookies['foo']

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2768 state:committed]
2009-10-15 10:58:55 +13:00
Jeffrey Hardy
a8dc9fd27b CookieJar#delete should return the key's value, consistent with a Hash
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-10-14 11:50:51 -07:00
Joshua Peek
8b46c50eac Kill mock routing assertion that tests router implementation 2009-10-10 21:30:51 -05:00
Joshua Peek
21be1dcffa Relative url generations are covered more thoroughly by url rewriter tests 2009-10-10 21:30:50 -05:00
Joshua Peek
5d071b4bc2 Drop implementation specific routing test assertions 2009-10-10 21:30:50 -05: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