Commit Graph

68 Commits

Author SHA1 Message Date
Joshua Peek
a79790e1a5 rack-test 0.4.2 has rack 1.1.pre goodies, we'll use it instead 2009-08-31 23:08:20 -05:00
Joshua Peek
5e5e34377c Back off rack 1.1-pre and bundle in the new testing goodies 2009-08-31 15:39:19 -05:00
Joshua Peek
ba5995dcd9 Reset session in integration tests after changing routes to reload the middleware stack 2009-08-27 12:43:26 -05:00
Yehuda Katz
1310231c15 Got tests to pass with some more changes.
* request.formats is much simpler now
    * For XHRs or Accept headers with a single item, we use the Accept header
    * For other requests, we use params[:format] or fallback to HTML
    * This is primarily to work around the fact that browsers provide completely
      broken Accept headers, so we have to whitelist the few cases we can
      specifically isolate and treat other requests as coming from the browser
    * For APIs, we can support single-item Accept headers, which disambiguates
      from the browsers
  * Requests to an action that only has an XML template from the browser will
    no longer find the template. This worked previously because most browsers
    provide a catch-all */*, but this was mostly accidental behavior. If you
    want to serve XML, either use the :xml format in links, or explicitly
    specify the XML template: render "template.xml".
2009-08-15 12:32:02 -07:00
Yehuda Katz
4bf516e072 More perf work:
* Move #set_cookie and #delete_cookie inline to optimize. These optimizations should
    almost certainly be sent back upstream to Rack. The optimization involves using
    an ivar for cookies instead of indexing into the headers each time.
  * Was able to use a bare Hash for headers now that cookies have their own joining
    semantics (some code assumed that the raw cookies were an Array).
  * Cache blankness of body on body=
  * Improve expand_cache_key for Arrays of a single element (common in our case)
  * Use a simple layout condition check unless conditions are used
  * Cache visible actions
  * Lazily load the UrlRewriter
  * Make etag an ivar that is set on prepare!
2009-08-11 15:03:53 -07:00
Yehuda Katz
0adbeeb0c9 Got overhead down from 127 to 85. All tests pass:
* Tentatively replaced HeaderHash with SimpleHeaderHash, which does not preserve
    case but does handle converting Arrays to Strings in to_hash. This requires
    further discussion.
  * Moved default_charset to ActionDispatch::Response to avoid having to hop over
    to ActionController. Ideally, this would be a constant on AD::Response, but
    some tests expect to be able to change it dynamically and I didn't want to change
    them yet.
  * Completely override #initialize from Rack::Response. Previously, it was creating
    a HeaderHash, and then we were creating an entirely new one. There is no way to
    call super without incurring the overhead of creating a HeaderHash.
  * Override #write from Rack::Response. Its implementation tracks Content-Length,
    and doing so adds additional overhead that could be mooted if other middleware
    changes the body. It is more efficiently done at the top-level server.
  * Change sending_file to an instance_variable instead of header inspection. In
    general, if a state is important, it should be set as a property of the response
    not reconstructed later.
  * Set the Etag to @body instead of .body. AS::Cache.expand_cache_key handles
    Arrays fine, and it's more efficient to let it handle the body parts, since
    it is not forced to create a joined String.
  * If we detect the default cache control case, just set it, rather than setting
    the constituent parts and then running the normal (expensive) code to generate
    the string.
2009-08-11 15:03:53 -07:00
Yehuda Katz
503ce1d01c Update cache_control to be a Hash of options that is used to build the header.
* Significantly simplifies setting and modifying cache control in other areas
2009-08-02 19:39:33 -04:00
Pratik Naik
e033b5d037 Merge docrails 2009-07-25 16:03:58 +01:00
Yehuda Katz
1a2946a6d9 Add some missing dependencies 2009-07-15 14:16:30 -07:00
Pratik Naik
97159fad6a Missed file from the previous commit 92b229e125 2009-06-25 17:03:07 +01:00
Pratik Naik
92b229e125 Make performance tests work again 2009-06-25 17:02:04 +01:00
Yehuda Katz + Carl Lerche
18c3b77b23 Merge process2 into process to people's regular tests run :P 2009-06-16 10:46:03 -07:00
Yehuda Katz + Carl Lerche
5a8a550a45 Finish making things pass with updated internal content_type semantics 2009-06-15 11:21:08 -07:00
Xavier Noria
d32965399c uses Object#metaclass and Object#class_eval in a few spots
[#2797 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-12 16:14:06 -07:00
Joshua Peek
4e50a35fa2 Break up DependencyModule's dual function of providing a "depend_on" DSL and "included" block DSL into separate modules. But, unify both approaches under AS::Concern. 2009-05-28 11:35:36 -05:00
Carl Lerche
a3ca5638d3 Get controller/test_test.rb to pass on new base 2009-05-26 14:13:35 -07:00
Pratik Naik
9d08f86cd4 Make assertion tests pass with the new base 2009-05-22 19:01:52 +02:00
Yehuda Katz + Carl Lerche
e693f45e15 Remove some response content type concepts from ActionView 2009-05-21 14:34:56 -07:00
Pratik Naik
386ff66e5e Add Streaming to new base 2009-05-21 21:48:42 +02:00
Pratik Naik
e21d1614bb Made ActionController::Verification work with new_base 2009-05-21 02:55:25 +02:00
Yehuda Katz + Carl Lerche
01f032f256 Added responds_to to new base. 2009-05-20 15:34:26 -07:00
Joshua Peek
6761759a90 Temporarily bundle rack-test while MockSession is baking 2009-05-19 22:43:22 -05:00
Bryan Helmkamp
df0faea378 Refactor ActionController instantiation capture 2009-05-19 22:43:21 -05:00
Bryan Helmkamp
0029d5e594 Integrating Rack::MockSession (from Rack::Test) 2009-05-19 22:43:21 -05:00
Pratik Naik
4a6f4b92ad Change integration test helpers to accept Rack environment instead of just HTTP Headers.
Before :  get '/path', {}, 'Accept' => 'text/javascript'
  After  :  get '/path', {}, 'HTTP_ACCEPT' => 'text/javascript'
2009-05-19 23:50:03 +02:00
Joshua Peek
c3319504f0 Rescue hack was supposed to be removed. Some how it crept back in. 2009-05-17 12:24:59 -05:00
Jeremy Kemper
e8550ee032 Cherry-pick core extensions 2009-05-13 12:00:15 -07:00
Yehuda Katz + Carl Lerche
216309c165 Implemented redirects and partial rendering in new base. 2009-05-12 16:21:34 -07:00
Yehuda Katz + Carl Lerche
00a9d4b91c Merge branch 'master' into wip_abstract_controller
Conflicts:
	actionpack/lib/action_controller/abstract/callbacks.rb
	actionpack/lib/action_controller/abstract/renderer.rb
	actionpack/lib/action_controller/base/base.rb
	actionpack/lib/action_controller/dispatch/dispatcher.rb
	actionpack/lib/action_controller/routing/route_set.rb
	actionpack/lib/action_controller/testing/process.rb
	actionpack/test/abstract_controller/layouts_test.rb
	actionpack/test/controller/filters_test.rb
	actionpack/test/controller/helper_test.rb
	actionpack/test/controller/render_test.rb
	actionpack/test/new_base/test_helper.rb
2009-05-11 17:07:05 -07:00
Yehuda Katz + Carl Lerche
6694bd46f5 Aliased AbstractController::ActionNotFound to ActionController::UnknownAction 2009-05-11 12:45:26 -07:00
Joshua Peek
f32cf44870 Switch functional tests to run through the rack interface instead of process 2009-05-02 15:29:18 -05:00
Joshua Peek
a8b75c480f Functional test runner finalizes response just like the integration test runner. In both runners, the @response object will now behave the same.
Some functional tests will need to be updated if they are relying on preprocessed data on the response.
2009-05-02 14:57:40 -05:00
Joshua Peek
3900f4007e Deprecate assert_redirect_to's partial hash matching 2009-05-02 14:23:44 -05:00
Yehuda Katz
72160d9f89 Implement FooController.action(:name)
* Rails actions are now Rack endpoints, and can be retrieved
    via FooController.action(name) and called with an env
  * Updated some tests that relied on the old internal
    #process/#call implementation
2009-05-02 02:15:09 -07:00
Yehuda Katz + Carl Lerche
ad2a1b5cb1 Get render :inline working 2009-05-01 18:17:08 -07:00
Yehuda Katz + Carl Lerche
7dd072d333 A few more tweaks to get new Base running old render tests again 2009-05-01 17:53:20 -07:00
Yehuda Katz + Carl Lerche
b1d34b3aa4 Starting to get new_base to run on old tests 2009-05-01 17:31:03 -07:00
Joshua Peek
05bd863c02 alias method chain process with test 2009-04-30 23:46:35 -05:00
Joshua Peek
1fcc7dbcc8 Move TestRequest#query_parameters into AD TestRequest 2009-04-30 23:46:34 -05:00
Joshua Peek
0fa1e75d41 Set rack.input instead of RAW_POST_DATA in TestRequest 2009-04-30 20:04:55 -05:00
Joshua Peek
261ec996de Missed stray @request_uri 2009-04-30 19:36:18 -05:00
Joshua Peek
a6fff94baf Move TestRequest cookies accessor into AD TestRequest 2009-04-30 19:23:50 -05:00
Joshua Peek
00d1a57e9f Start moving TestRequest and TestResponse into ActionDispatch 2009-04-30 17:26:03 -05:00
Joshua Peek
64e66cf161 Vendor new Rack::Mock changes 2009-04-30 14:40:46 -05:00
Joshua Peek
9bac470c7a Group integration test helpers and delegate other helpers to request and response objects 2009-04-30 14:28:42 -05:00
Joshua Peek
ba9887c9c0 Switch to action_dispatch rack namespace 2009-04-30 13:45:12 -05:00
Joshua Peek
7b3b7cb2ab Move generic assertions into ActionDispatch 2009-04-30 11:55:53 -05:00
Joshua Peek
98dd726687 Test::Unit work arounds are handled by ActiveSupport 2009-04-30 11:42:01 -05:00
Joshua Peek
988513ac7a Framework backtrace cleaning is handled by ActiveSupport now 2009-04-30 11:42:01 -05:00
Joshua Peek
c0a372ba87 Deprecate template, session, assigns, and layout accessors on response object. Instead access them through the controller instance. This mainly affects functional test assertions. 2009-04-28 23:29:46 -05:00