Commit Graph

1199 Commits

Author SHA1 Message Date
Pratik Naik
d67e03871e Make ActionController#render(string) work as a shortcut for render :template => string. [#1435]
Examples:
  # Instead of render(:template => 'controller/action')
  render('controller/action')

Note : Argument must not begin with a '/', but have at least one '/'
2008-12-25 22:26:03 +00:00
Pratik Naik
061952392a Make ActionController#render(string) work as a shortcut for render :file => string. [#1435]
Examples:
  # Instead of render(:file => '/Users/lifo/home.html.erb')
  render('/Users/lifo/home.html.erb')

Note : Filename must begin with a forward slash ('/')
2008-12-25 21:43:07 +00:00
Pratik Naik
04a8b2362d Make render_test.rb run in isolation 2008-12-25 19:28:08 +00:00
Pratik Naik
6e2a771661 Undry ActionController::TestCase#<HTTP_METHODS> for better documentation 2008-12-25 17:54:44 +00:00
Pratik Naik
e898f82a74 Move request parsing related code to ActionController::RequestParser 2008-12-25 03:51:04 +00:00
Joshua Peek
9c1e48eaea ActionController::VerbPiggybacking middleware 2008-12-23 13:36:05 -06:00
Pratik Naik
293bb02f91 Unify ActionController::AbstractRequest and ActionController::Request 2008-12-23 00:30:32 +00:00
Pratik Naik
7e1751111e Rename RackRequest to Request 2008-12-23 00:30:32 +00:00
Pratik Naik
f5b7f0911b Merge commit 'fred/more_pullable' 2008-12-21 19:04:48 +00:00
=?utf-8?q?Adam=20Cig=C3=A1nek?=
fcd58dc27a Allow use of symbols for :type option of ActionController::Streaming#send_file/#send_data [#1232 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2008-12-21 18:58:55 +00:00
Frederick Cheung
cf9c36834a Fix failing cookie store test 2008-12-21 15:57:09 +00:00
Joshua Peek
3b317b7100 Switch to Rack::Response#set_cookie instead of using CGI::Cookie to build cookie headers 2008-12-20 21:25:47 -06:00
Frederick Cheung
606cd61b9a Fix Mime::Type#=~ not using Regexp.quote
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-12-21 02:24:22 +00:00
Matt Bauer
7b249b67e9 Fix reset_session with lazy cookie stores [#1601 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-20 14:37:51 -06:00
Joshua Peek
fda62ecf70 Rename AbstractResponse to Response and inheirt from Rack::Response 2008-12-19 17:15:22 -06:00
Joshua Peek
a14bbd7a85 Process CGI 'cookie' header into 'Set-Cookie' for all responses.
This mostly affects response.headers['cookie'] for test requests. Use response.cookies instead.
2008-12-19 16:49:06 -06:00
Joshua Peek
cbee72d216 Improve cookie test coverage 2008-12-19 16:35:23 -06:00
Joshua Peek
3da1b94d07 Use status response accessor instead of the 'Status' header 2008-12-19 15:05:51 -06:00
Joshua Peek
a9fde9a2ab Cleanup dispatch path 2008-12-18 13:14:09 -06:00
Joshua Peek
2eb2ec9e63 Move gaint lock into middleware 2008-12-18 12:00:54 -06:00
Lourens Naude
3ff6b00ee3 Persistent session identifier support for CookieSessionStore and API compat. with the server side stores [#1591 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-18 11:33:53 -06:00
Joshua Peek
175cb7a963 Fix metal tests 2008-12-17 10:10:24 -06:00
Jesse Newland
97a178bfa4 Decorate responses from Rack Middleware and Rails Metal for the purposes of integration testing. A test for the following Metal:
class Poller < Rails::Rack::Metal
      def call(env)
        if env["PATH_INFO"] =~ /^\/poller/
          [200, {"Content-Type" => "text/plain"}, "Hello World!"]
        else
          super
        end
      end
    end

might be tested like so:

  class PollerTest < ActionController::IntegrationTest
    test "poller returns hello world" do
      get "/poller"
      assert_response 200
      assert_response :success
      assert_response :ok
      assert_equal "Hello World!", response.body
    end
  end

[#1588 state:committed]

Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-12-17 15:59:47 +01:00
Joshua Peek
ec1bd98705 Session Fixation tests have been rolled into the session cookie tests 2008-12-16 16:28:39 -06:00
Hongli Lai (Phusion
9e2b4a10f7 Do not output an ETag header if response body is blank or when sending files with send_file(... :xsendfile => true) [#1578 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-12-16 12:30:28 +01:00
Joshua Peek
ed70830713 Switch to Rack based session stores. 2008-12-15 16:33:31 -06:00
Seth Fitzsimmons
f36dafa492 Implement Mime::Type.=~ to match all synonyms against arg [#1573 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 12:00:55 -06:00
mark
49306ccacf Add :partial option to assert_template [#1550 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-11 11:06:35 -06:00
Christos Zisopoulos
69387ce016 Fix for Integration::Session follow_redirect! headers['location'] bug with Rack [#1555 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-10 18:38:28 -06:00
Jeremy Kemper
9adcf951ea Fix failing test introduced by optional-format routes 2008-12-08 19:19:48 -08:00
Joshua Peek
ebec9d43e2 Make integration test runner more Rack friendly and clean out old CGI cruft 2008-12-08 12:33:16 -06:00
Joshua Peek
731dcd8404 Silence server backtrace in rescue templates and log files. Also remove some noise from missing template errors. 2008-12-05 11:24:28 -06:00
Joshua Peek
9c9da6c892 Boot out CGI Processor.
* Add ActionController::CGIHandler as a backwards compatible CGI wrapper around Rack.
* Also pull failsafe responder into ActionController::Failsafe middleware.
2008-12-04 20:39:36 -06:00
Joshua Peek
27ebfd795f Ensure route set is cleared on teardown 2008-12-04 19:10:52 -06:00
Joshua Peek
148aff2097 Set template_format to html inside rjs templates so renders within it default to html. 2008-12-04 17:20:51 -06:00
Sam Stephenson
ab211bf592 Fix rendering html partials from an rjs template
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-04 16:35:13 -06:00
Joshua Peek
40e9ba1e46 Refactor SessionFixationTest and WebServiceTest with IntegrationTest so they are compatible with the Rack interface. 2008-12-04 09:43:06 -06:00
Darren Boyd
0a4a5f3129 Making the IP Spoofing check in AbstractRequest#remote_ip configurable.
Certain groups of web proxies do not set these values properly.  Notably,
proxies for cell phones, which often do not set the remote IP information
correctly (not surprisingly, since the clients do not have an IP address).

Allowing this to be configurable makes it possible for developers to choose
to ignore this simple spoofing check, when a significant amount of their
traffic would result in false positives anyway.

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#1200 state:committed]
2008-12-01 20:40:18 +01:00
Jeremy Kemper
93456a2ed2 Deprecated formatted_polymorphic_url 2008-11-30 17:04:24 -08:00
Joshua Peek
9fc23745f1 Reinstate "Super lazy load view paths in development mode (no indexing or caching at all). Switch layout finders to use view path api to take advantage of cache." as it killed dev mode reloading." 2008-11-28 11:18:28 -06:00
David Heinemeier Hansson
5fa0457542 Revert "Super lazy load view paths in development mode (no indexing or caching at all). Switch layout finders to use view path api to take advantage of cache." as it killed dev mode reloading.
This reverts commit 4d910b033379727e5e7355590c50c72fc75e56db.
2008-11-27 21:04:24 +01:00
Joshua Peek
4d910b0333 Super lazy load view paths in development mode (no indexing or caching at all). Switch layout finders to use view path api to take advantage of cache. 2008-11-26 20:54:47 -06:00
David Heinemeier Hansson
7d8f9ef051 Fix routing test and add changelog note about draw no longer clearing the route set 2008-11-26 20:26:55 +01:00
David Heinemeier Hansson
40b40c4870 Added support for multiple routes files and made draw not clear the map so they can be additive 2008-11-26 15:57:36 +01:00
Aaron Batalion
fef6c32afe Added optimal formatted routes to rails, deprecating the formatted_* methods, and reducing routes creation by 50% [#1359 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-11-26 10:52:05 +01:00
Jeremy Kemper
4073a6d0a2 Remove XmlSimple dependencies 2008-11-25 19:49:49 -08:00
Joshua Peek
d4754677a3 Deprecate assert_valid 2008-11-25 12:32:14 -06:00
Geoff Garside
61becfe2b9 Test default singleton resource route to ensure it uses GET. This is important if using map.root :resource instead of map.root :resources for some reason.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-24 19:19:56 +01:00
Joshua Peek
31ce92f7b5 Use autoload instead of explicit requires for ActionController 2008-11-23 16:35:47 -06:00
Jeremy Kemper
2db8571edf Don't hide deeper LoadErrors 2008-11-23 13:10:27 -08:00
Michael Koziarski
04d2d043ca Move the cookie store to use the MessageVerifier class.
This removes support for ancient cookie-store generated cookies which were double escaped.
2008-11-23 16:42:15 +01:00
Michael Koziarski
9fdb15e60f Change the forgery token implementation to just be a simple random string.
This deprecates the use of :secret and :digest which were only needed when we were hashing session ids.
2008-11-23 14:28:34 +01:00
Sam Pohlenz
5ea9f2cac6 Allow helpers directory to be overridden via ActionController::Base.helpers_dir (Sam Pohlenz) [#1424 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-11-23 13:42:53 +01:00
Jeremy Kemper
51383c57a2 MiniTest compat: don't check for test/unit's assertion in particular 2008-11-22 19:19:12 -08:00
Joshua Peek
20d6fdd256 write_fragment returns content if caching is disabled [#846 state:resolved] 2008-11-22 13:19:11 -06:00
Lance Ivy
cd1a9ed991 Add TestResponse#client_error? to check for 4xx status codes [#851 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-11-22 13:10:12 -06:00
David Heinemeier Hansson
f42c77f927 Added ActiveSupport::BacktraceCleaner and Rails::BacktraceCleaner for cutting down on backtrace noise (inspired by the Thoughtbot Quiet Backtrace plugin) [DHH] 2008-11-22 18:06:08 +01:00
Pratik Naik
27c03e69e9 Remove deprecated render_component. Please use the plugin from http://github.com/rails/render_component/tree/master 2008-11-19 17:48:57 +05:30
Hiroshi Saito
291d199de1 Let polymorphic_path treat an array contains single name as without array [#1386 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-11-19 12:07:12 +01:00
Gabe da Silveira
917428bcce Make optimized named routes respect all reserved options and tie it into UrlRewriter::RESERVED_OPTIONS so it's DRY
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-18 22:47:33 +01:00
Luke Melia
60d6f25517 Fix rendering html partial via inline render when with :js format [#1399 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-11-18 15:19:16 -06:00
Luke Melia
75fb8dfb99 Prevent assert_template failures when a render :inline is called before rendering a file-based template [#1383 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-11-17 22:09:22 -06:00
Jeremy Kemper
eeea1a26ec Merge branch 'master' into testing 2008-11-15 12:21:04 -08:00
Tom Stuart
2ecec6052f Make inheritance of map.resources :only/:except options behave more predictably
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-14 12:26:43 +01:00
hiroshi
94d6716324 Make polymorphic_url compact given array [#1317 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-11-14 12:07:52 +01:00
Tom Stuart
4c09210244 Fix map.resources to always generate named routes if they're needed
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-13 17:49:09 +01:00
Michael Koziarski
f1ad8b48aa Instead of overriding html_types, base the verification on browser_generated_types.
Also Deprecate the old unverifiable types.

[#1145 state:committed]
2008-11-13 11:23:34 +01:00
rick
00c46b5eeb fix two MimeType failing test cases
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-13 11:23:34 +01:00
Jeff Cohen
fbbcd6f29a Changed request forgery protection to only worry about HTML-formatted content requests.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-13 11:23:21 +01:00
Tom Stuart
44a3009ff0 Add :only/:except options to map.resources
This allows people with huge numbers of resource routes to cut down on the memory consumption caused by the generated code.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1215 state:committed]
2008-11-12 12:57:58 +01:00
Jeremy Kemper
d87d3f76d5 Ruby 1.9 compat: rescue Exception since minitest's assertion doesn't subclass StandardError 2008-11-08 22:46:13 -05:00
Jeremy Kemper
8bfd5edbcf Wrap straggling mocha user with uses_mocha block 2008-11-08 22:43:56 -05:00
Jeremy Kemper
eda9f49d57 Ruby 1.9 compat: CGI switched back to Tempfile 2008-11-08 22:43:29 -05:00
Jeremy Kemper
8a1f913381 Workaround lack of Mocha on 1.9 (hasn't been updated for minitest yet) 2008-11-08 22:35:30 -05:00
Jeremy Kemper
ace9e533dc Merge branch 'master' into testing 2008-11-08 18:58:29 -05:00
Pratik Naik
5cc27f2b03 Add some basic controller logging tests 2008-11-08 18:45:19 +05:30
Jeremy Kemper
c0310bde48 Merge branch 'master' into testing 2008-11-07 21:51:08 -05:00
Jeremy Kemper
0be5bc3f59 Work around ruby 1.9 segfault 2008-11-07 21:50:39 -05:00
Jeremy Kemper
c82e8e1f48 Move controller assertions from base TestCase to AC:: and AV::TestCase 2008-11-07 15:42:34 -05:00
David Heinemeier Hansson
a358d87e16 Fixed the sanitize helper to avoid double escaping already properly escaped entities [#683 state:committed] 2008-11-06 13:02:32 +01:00
David Heinemeier Hansson
cbeac93310 Added render :js for people who want to render inline JavaScript replies without using RJS [DHH] 2008-11-01 12:03:49 +01:00
Joshua Peek
2092687bcb Ensure content type gets reset after render_to_string [#1182 state:resolved] 2008-10-30 15:26:29 -05:00
Seth Fitzsimmons
47b4fa4a62 Fixed regex in redirect_to to fully support URI schemes [#1247 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-10-30 21:07:50 +01:00
Jeffrey Hardy
3bcadc9290 Fix incorrect closing CDATA delimiter. Add tests for CDATA nodes.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-10-23 19:16:26 -07:00
Jeffrey Hardy
1a18227261 Fix that HTML::Node.parse would blow up on unclosed CDATA sections.
If an unclosed CDATA section is encountered and parsing is strict, an
exception will be raised. Otherwise, we consider the remainder of the line to
be the section contents. This is consistent with HTML::Tokenizer#scan_tag.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-10-23 19:16:12 -07:00
David Heinemeier Hansson
18542c9e00 Dont try to auto-set the etag based on the body if any freshness headers have already been set [DHH/José Valim] 2008-10-21 16:58:12 +02:00
David Heinemeier Hansson
448e7e7c04 Let fresh_when actually do the head(:not_modified). Cleaner and we get the filter halting for free then. 2008-10-21 02:54:55 +02:00
David Heinemeier Hansson
68d84e2593 Merge branch 'master' of git@github.com:rails/rails 2008-10-21 02:30:57 +02:00
David Heinemeier Hansson
9acb88e666 Added stale?/fresh? and fresh_when methods to provide a layer of abstraction above request.fresh? and friends [DHH] 2008-10-21 02:30:13 +02:00
Tim Harper
fcb45e5ec3 Ensure ActionView::Helpers::AssetTagHelper::AssetTag::Cache is cleared before loading so changes to asset files are picked up by the broswer [#1233 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-10-20 13:21:59 -05:00
Eloy Duran
b47c76b1df Make sure named routes with parameters can be used in tests before a request has been done. [#1208 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-10-13 18:38:48 +02:00
Tom Stuart
e28ad77bba Allow use of :path_prefix and :name_prefix outside of namespaced routes. [#1188 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-10-08 14:56:52 +01:00
Michael Koziarski
aec391621b Make sure last_modified! works with <= rather than just equality. 2008-10-07 21:09:07 +02:00
Pratik Naik
5e3517ea7b Ensure rescue_from handlers are respected inside tests. [#835 state:resolved]
Note : If you're not using rescue_from, you should overrider rescue_action_without_handler() method
and not rescue_action(). Afterwards, you can set request.remote_addr to a non "0.0.0.0" value for testing the
overridden behavior.
2008-10-04 18:43:46 +01:00
Michael Koziarski
0eefa7058a Fix etag! and last_modified! to work as advertised.
Add tests too.
2008-09-30 17:00:38 +02:00
Pelle Braendgaard
7ecb9689b0 Added support for http_only cookies in cookie_store Added unit tests for secure and http_only cookies in cookie_store
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1046 state:committed]
2008-09-17 13:20:16 +02:00
Sven Fuchs
a18ed6d563 Added ActionController::Translation module delegating to I18n #translate/#t and #localize/#l [status:committed #1008]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-09-10 00:39:54 -05:00
Matt Jones
7e6cda15f8 Ensure routing optimizations are cleared when new routes are added [#981 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-09-07 10:21:34 -05:00
Jonathan del Strother
6cfb70023a Don't set Content-Length on 304 responses
Commit 8aad8c claimed to do this, but it checks for the 304 status too early, before handle_conditional_get! has overridden it.

[#958 state:resolved]

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-02 22:57:40 +02:00
Jeremy Kemper
a1eb4e11c2 Get rid of 'Object#send!'. It was originally added because it's in Ruby 1.9, but it has since been removed from 1.9.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>

Conflicts:

	actionpack/test/controller/layout_test.rb
2008-08-31 13:20:15 -07:00
Luke Melia
7ce03db778 Fixes optimised named routes generating question mark followed by nothing when provided an empty hash as the last argument.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#481 state:committed]
2008-08-31 19:42:01 +02:00
Joshua Peek
086c3520c4 Moved layout exemption logic into the view 2008-08-31 11:34:46 -05:00
Pratik Naik
56c2b02f59 Fix AM tests and add tests for rendering logging 2008-08-31 16:29:21 +01:00
Pratik Naik
a59a3db1f3 Move copying ivar logic from ActionController::Base to ActionView::Base 2008-08-31 03:48:09 +01:00
Pratik Naik
4fb75392aa Add test to make sure RJS block inside controller is executed in view context 2008-08-30 21:47:35 +01:00
Pratik Naik
83c6ba1889 Add support for shallow nesting of routes. [#838 state:resolved]
Adds :shallow option to resource route definition. If true, paths for nested
resources which reference a specific member (ie. those with an :id parameter)
will not use the parent path prefix or name prefix.

Example :

map.resources :users, :shallow => true do |user|
  user.resources :posts
end

* GET /users/1/posts (maps to PostsController#index action as usual)
  named route "user_posts" is added as usual.

* GET /posts/2 (maps to PostsController#show action as if it were not nested)
  Additionally, named route "post" is added too.
2008-08-30 15:20:20 +01:00
miloops
11eb29f60a Make assert_select_rjs code more readable, make use of unused constants and use more simple Regexps.
[#540 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-29 17:52:26 -07:00
Tim Haines
d0b949d873 Improve assert_select_rjs failure messages for show, hide, toggle, and remove
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#931 state:committed]
2008-08-29 20:51:47 +02:00
Joshua Peek
a200c67611 Merge RenderTest and NewRenderTest 2008-08-29 13:26:28 -05:00
Pratik Naik
6577942b61 Deprecate render_component.
Please install render_component plugin from http://github.com/rails/render_component/tree/master
if your application uses this functionality.
2008-08-29 13:43:30 +01:00
Jeremy Kemper
766fb54c8f Fix indentation 2008-08-28 12:35:47 -07:00
Brennan Dunn
9cc8c0a0a1 Routes may be restricted to lists of HTTP methods instead of a single method or :any.
[#407 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-28 12:29:49 -07:00
Brennan Dunn
7bdd5b768e Accept an array of method symbols for collection/member actions of resources
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-28 12:23:39 -07:00
Joshua Peek
acbf2b74aa Deprecated implicit local assignments when rendering partials 2008-08-28 10:37:46 -05:00
Michael S. Klishin
e42a235dd1 Request#remote_ip handles the uncommon case that REMOTE_ADDR is a comma-separated list.
[#523 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:03:11 -07:00
Tim Haines
82778351a8 Add TestUploadFile.content_type= to match Request.UploadedFile
[#920 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 18:50:29 -07:00
Jeremy Kemper
e6a66cbd05 update rack tests for default response content_type and charset 2008-08-21 18:16:16 -07:00
Jeremy Kemper
f8f077945f Move default content type and charset from Base to Response. Handle charset = nil. 2008-08-21 18:11:09 -07:00
Tarmo Tänav
98fb161dbb Allow polymorphic_url helper to take url options. [#880 state:resolved]
All *_polymorphic_url, *_polymorphic_path helpers can now accept
an options hash which will be passed on to the named route
making it possible to generate polymorphic routes with additional
url parameters.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-21 20:26:00 +01:00
Joshua Peek
47cd8b81cc Switched integration test runner to use Rack processor instead of CGI 2008-08-20 13:37:18 -05:00
Joshua Peek
a74dbe6c52 Improve test coverage for integration tests cookie header 2008-08-20 13:22:36 -05:00
Joshua Peek
6f530de944 Test coverage for integration testing with parameters 2008-08-19 20:15:51 -05:00
Ryan Bates
a8ece12fe2 Return nil instead of a space when passing an empty collection or nil to 'render :partial' [#791 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-08-19 19:09:04 -05:00
Joshua Peek
71c4ff07ab Delegate xhr helper method to integration session 2008-08-19 18:53:46 -05:00
Ryan Bates
38c7d73e73 pass yielded arguments to block for ActionView::Base#render with :layout [#847 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-08-17 19:29:24 -05:00
Joshua Peek
dbb0abfb7e More integration test coverage 2008-08-17 19:18:18 -05:00
Joshua Peek
b8e930aa01 Merge RackProcess#normalize_headers logic into AbstractResponse#prepare! 2008-08-17 19:09:38 -05:00
Joshua Peek
894f9ccc53 Use RackRequest as a mock instead of StubCGI into RequestTest 2008-08-17 19:04:01 -05:00
Jeremy Kemper
45b79d933c Merge branch 'conditional-get' 2008-08-12 17:03:17 -07:00
Cameron Yule
2faf35cea9 Added tests for partial collection counters [#766 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-08-09 10:48:56 -05:00
Jeremy Kemper
ba2d61dd81 Update tests for request memoization 2008-08-08 02:31:12 -07:00
Jeremy Kemper
b7529ed1cc Simplifying usage of ETags and Last-Modified and conditional GET requests 2008-08-07 23:43:12 -07:00
Joshua Peek
b2504f8ba0 Tidy up ActionMailer rendering logic to take advantage of view path cache instead of using file system lookups 2008-08-06 20:11:21 -05:00
Tarmo Tänav
656f0e7c6c Fix file permissions
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-07-31 16:36:23 -05:00
Joshua Peek
a5db148825 Prepare Route#generate and Route#recognize early. Also refactor segments a bit to try to make immutable. 2008-07-28 13:41:42 -05:00
Joshua Peek
e0513e33c4 Routing whitespace cleanup 2008-07-28 13:38:20 -05:00
Joshua Peek
a87462afcb AbstractRequest.relative_url_root is no longer automatically configured by a HTTP header. It can now be set in your configuration environment with config.action_controller.relative_url_root 2008-07-24 13:41:51 -05:00
Joshua Peek
2681685450 Extract ActiveSupport::TypedArray class to ensure an array is all of the same type [#673 state:resolved] 2008-07-22 11:12:16 -05:00
Tom Ward
d39485078e Raise ArgumentError if an invalid method is specified as part of a route's conditions. Also raise an error if HEAD is specified as the method, as rails routes all HEAD requests through the equivalent GET, though doesn't return the response body [#182 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-07-18 20:19:03 -05:00
Tom Ward
c3d1fda555 Set the response content type to that of found template if not explicitly set elsewhere [#444 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-07-18 20:14:12 -05:00
Joshua Peek
d2ccb852d4 Removed lagacy TemplateHandler#render API. Left in a legacy TemplateHandler and Compilable stub so plugins will not have to change anything. 2008-07-18 16:00:20 -05:00
Jeremy Kemper
57a2780f14 etag! and last_modified! conditional GET helpers 2008-07-17 23:18:10 -07:00
Pratik Naik
99930d499e Fix symbol cookie test 2008-07-17 18:19:09 +01:00
Ripta Pasay
f7fdbae770 Use fully-qualified controller name when logging. [#600 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-17 01:33:44 +01:00
Pratik Naik
90c930f45c Allow Dispatcher exceptions to be handled in application.rb using rescue_from 2008-07-16 18:54:08 +01:00
Pratik Naik
2a7aca8ec3 Improve rack/cgi tests 2008-07-16 05:07:34 +01:00
Pratik Naik
1d002f6bcb Make RackRequest#request_method respect _method 2008-07-16 05:02:29 +01:00
Pratik Naik
5cc3ea6969 RackResponse should not contain Status header 2008-07-16 04:17:28 +01:00
Pratik Naik
3343eb428c Tests for rack response content type 2008-07-16 04:09:41 +01:00
Pratik Naik
89eec91e67 Add tests for CgiRequest#content_type 2008-07-16 03:31:45 +01:00
Pratik Naik
0f8206104e RackRequest#content_type should return Mime::Type 2008-07-16 03:18:35 +01:00
Joshua Peek
8b306bf24c Improved test coverage for fragment cache helper 2008-07-15 20:54:17 -05:00
Joshua Peek
aca246ab25 Get buffer for fragment cache from template's @output_buffer 2008-07-15 14:43:52 -05:00
Michael Koziarski
24a8ae4e08 Try to get more useful errors out of the test_line_offset failures 2008-07-15 20:39:36 +02:00
Joshua Peek
e0fef66149 Made ActionView::Base#first_render a little more private. And added _last_render to track the most recent render. Will fix #609 as a side effect. [#609 state:resolved] 2008-07-13 13:26:48 -05:00
Joshua Peek
73b34e9f75 Refactor template preloading. New abstractions include Renderable mixins and a refactored Template class. 2008-07-12 14:33:46 -05:00
Joshua Peek
30204c4e66 Set global ActionController::Base.view_paths for test cases 2008-07-12 14:11:51 -05:00
Joshua Peek
65fb2e76f2 Removed a few implementation specific view path tests 2008-07-12 12:17:10 -05:00
Michael Koziarski
e53f5fe696 Restore support for partial matches in assert_redirected_to
If both the actual redirection and the asserted redirection are hashes, succeed if the asserted redirection is a strict subset of the actual redirection.
2008-07-12 11:42:41 +02:00
Joshua Peek
6ebdd0e32b Changed ActionView::TemplateHandler#render API method signature to render(template, local_assigns = {}) 2008-07-11 15:40:41 -05:00
Joshua Peek
04a87af5b7 Ensure use_accept_header is enabled for test_action_cache_conditional_options 2008-07-11 11:51:35 -05:00
Joshua Peek
d106f2d08a Ensure use_accept_header is enabled for test_action_cache_conditional_options 2008-07-11 11:49:22 -05:00
Joshua Peek
15b2175426 Fixed teardown method typo (plus whitespace) 2008-07-11 11:44:24 -05:00
Jeremy Kemper
a6d0ae28e3 Fix teardown method name typo 2008-07-09 10:42:30 -07:00
Jeremy Kemper
4354aa36fb Rendering default template for missing actions works with non-word characters in action name 2008-07-09 10:42:29 -07:00
Michael Koziarski
2f4aaed7b3 Disable the Accept header by default
The accept header is poorly implemented by browsers and causes strange errors when used on public sites where crawlers make requests too.  You should use formatted urls (e.g. /people/1.xml) to support API clients. Alternatively to re-enable it you need to set:

config.action_controller.use_accept_header = true

A special case remains for ajax requests which will have a javascript format for the base resource (/people/1) if the X-Requested-With header is present.  This lets ajax pages still use format.js despite there being no params[:format]
2008-07-07 07:31:49 +02:00
Michael Koziarski
c3aaba0180 Simplify the implementation of assert_redirected_to to normalise the urls before comparing. Also allows for a simpler implementation of redirect_to without most of the recursion.
Also allows for assert_redirected_to @some_record
2008-07-04 10:41:40 +03:00
Michael Koziarski
db58391079 Remove old broken follow_redirect from functional tests. Still works in integration tests.
The follow_redirect in functional tests only worked if you used redirect_to :id=>foo, :action=>bar, rather than named routes.
2008-07-04 10:41:40 +03:00
Joshua Peek
01637796d7 Revert "Moved TemplateHandlers to Base"
This reverts commit 42d215a925a228778e43f7040f03ad8f3eb5341c.

Conflicts:

	actionpack/lib/action_view/inline_template.rb
	actionpack/lib/action_view/template.rb
2008-07-03 21:09:37 -05:00
josevalim
bad1eac91d Allow caches_action to accept cache store options. [#416 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-04 02:00:51 +01:00
Joshua Peek
42d215a925 Moved TemplateHandlers to Base 2008-07-03 12:48:00 -05:00
Michael Koziarski
12cf8f348b Move template_format logic out to the request so it's alongside the 'regular' request format.
Use xhr? instead of the expensive trip through Request#accepts.
2008-07-03 19:43:06 +03:00
Michael Koziarski
efd18066a2 Tighten the rescue clause here to prevent hiding strange mock related errors behind the line offset test 2008-07-03 19:21:04 +03:00
Tarmo Tänav
a37d065f85 Use :namespace instead of :path_prefix for finding controller. [#544 state:resolved]
:namespace is supposed to be the module where controller exists.
:path_prefix can contain anything, including variables, which
makes it unsuitable for determining the module for a controller.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-03 16:11:50 +01:00
Joshua Peek
3b3790a435 Deprecate :use_full_path render option. The supplying the option no longer has an effect. 2008-07-02 21:38:58 -05:00
Mike Subelsky
8f640c381d Added application/jsonrequest as a synonym for application/json
[#536 state:resolved]
2008-07-02 11:39:42 -07:00
Pratik Naik
2b43620e3c Add :as option to render a collection of partials with a custom local variable name. [#509 state:resolved] [Simon Jefford, Pratik Naik] 2008-07-02 16:40:42 +01:00
Tim Haines
f5052dd8a3 Make sure render :template works with :locals. [#524 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-02 04:30:34 +01:00
Joshua Peek
aff2d33172 Improved test coverage and added RackRequest support for CGI environment variables. 2008-07-01 21:53:55 -05:00
Joshua Peek
339491a6b3 Set precompiled fixture load path constant to speed up tests 2008-06-25 15:24:12 -05:00
Joshua Peek
6f5327013d Consolidate CustomHandlerTest, TemplateFileTest, and TemplateObjectTest and test them at a higher level of abstraction in ViewRenderTest. 2008-06-25 05:49:38 -05:00
Jimmy Baker
670e22e372 Patched HTML::Document#initialize call to Node.parse so that it includes the strict argument. [#330] 2008-06-24 23:11:35 -07:00
Tammer Saleh
bb6e8eea5a Fixed polymorphic_url to be able to handle singleton resources.
Example usage:
polymorphic_url([:admin, @user, :blog, @post]) # => admin_user_blog_post_url(@user, @post)

[#461 state:resolved]
2008-06-22 18:58:47 -07:00
Joshua Peek
40557e17dd Improved test coverage for integration test's api 2008-06-17 21:25:51 -05:00
Joshua Peek
bec4b69a3b Replaced TemplateFinder abstraction with ViewLoadPaths 2008-06-17 21:21:07 -05:00
Luke Redpath
7650ff892c Fix url_for with no arguments when default_url_options is not explicitly defined. [#339 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-17 20:53:41 +01:00
Amos King
1b4b8fbbd9 verify :redirect_to => :back should redirect to the referrer. [#280 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-17 18:08:56 +01:00
David Heinemeier Hansson
6573f6a4bc Revert "Lazy load cache and session stores"
This reverts commit 19895f087c338d8385dff9d272d30fb87cb10330.
2008-06-12 19:52:33 -05:00
Jonathan del Strother
3e07f320c1 Improve ActionCaching's format-handling
Make ActionCaching more aware of different mimetype formats.
It will now use request.format to look up the cache type, in addition to the path extension.
When expiring caches, the request format no longer affects which cache is expired.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-11 13:15:01 +01:00
Pratik Naik
0ad0bdc01c Delegate ActionView::Base#controller_name to controller 2008-06-10 23:55:04 +01:00
Pratik Naik
19895f087c Lazy load cache and session stores 2008-06-10 10:29:25 +01:00
Joshua Peek
d5539958a8 Wrap CGIResponse, LegacyRouteSet, Route, RouteSet and RouteLoading tests inside mocha block. 2008-06-07 23:42:05 -05:00
Jeremy Kemper
fe9d2ad6e8 Remove some internal dead code that supported content_for 2008-06-06 18:01:14 -07:00
Jeremy Kemper
9c9da5d927 Merge branch 'master' into erbout 2008-06-05 17:34:14 -07:00
Pratik Naik
1dbfe9766e Ensure render :file works inside templates 2008-06-05 23:33:10 +01:00
Frederick Cheung
2e0765a003 Make partial counter start from 0.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-05 22:11:40 +01:00
Jeremy Kemper
e7f1556d0e Merge branch 'master' into erbout 2008-06-05 13:25:33 -07:00
Joshua Peek
c4d570c2eb Use CGI::Cookie::parse for request cookies until we officially deprecated CGI. 2008-06-04 22:32:09 -05:00
Jeremy Kemper
53bcbfbdc1 Merge branch 'master' into erbout 2008-06-03 22:38:27 -07:00
David Heinemeier Hansson
885453537e Merge branch 'master' of git@github.com:rails/rails 2008-06-03 18:12:56 -05:00