Commit Graph

2084 Commits

Author SHA1 Message Date
Aaron Patterson
a6bdae1c19 flushing output should write to the stream rather than mutating the response object 2012-07-29 17:02:00 -07:00
Aaron Patterson
19e68e9d47 remove dead test 2012-07-29 16:00:50 -07:00
Aaron Patterson
356787fce8 adding a buffered stream to the response object 2012-07-29 15:51:21 -07:00
Rafael Mendonça França
82667c84e1 Remove warning renaming the test classes to use the test convention 2012-07-29 17:47:05 -03:00
Aaron Patterson
f79b29a5a8 this test is not a controller test, so switch to AS::TC 2012-07-28 20:30:52 -07:00
Brian John
35fe3107a3 Clean up Sweeper controller accessor when an Error is raised 2012-07-20 05:49:45 -05:00
Piotr Sarnacki
542637e679 Fix indentation. 2012-07-11 02:07:25 +02:00
Piotr Sarnacki
df40d79fdc Don't raise an error if http auth token isn't well formatted
When someone sends malformed authorization header, like:

    Authorization: Token foobar

given token should be just ignored and resource should not be authorized,
instead of raising error. Before this patch controller would return 401 header
only for well formed tokens, like:

    Authorization: Token token=foobar

and would return 500 in former case.
2012-07-11 01:56:38 +02:00
Aaron Patterson
d481170251 deprecate describe without a block.
minitest/spec provides `describe`, so deprecate the rails version and
have people use the superclass version
2012-07-09 13:13:59 -07:00
Carlos Antonio da Silva
ea7b48b074 Use "instance_accessor" for flash types class attribute 2012-07-07 09:16:48 -03:00
kennyj
238a4253bf Added support add_flash_types 2012-07-07 17:07:57 +09:00
kennyj
1498071b92 Remove unused code. 2012-07-07 14:59:49 +09:00
Mircea Pricop
021f3d24f3 Prevent conflict between mime types and Object methods
Assuming the type ":touch", Collector.new was calling
send(:touch), which instead of triggering method_missing
and generating a new collector method, actually
invoked the private method `touch` inherited from
Object.

By generating the method for each mime type as it
is registered, the private methods on Object can
never be reached by `send`, because the `Collector`
will have them before `send` is called on it.

To do this, a callback mechanism was added to Mime::Type

This allows someone to add a callback for whenever
a new mime type is registered. The callback then
gets called with the new mime as a parameter.

This is then used in AbstractController::Collector
to generate new collector methods after each mime
is registered.
2012-07-06 20:38:23 +02:00
Aaron Patterson
a7826bd8b7 Merge branch 'master' into testclean
* master:
  Add documentation for inheritance_column method
  Use ArgumentError vs. RuntimeError, which is more precise.
  CSV fixtures aren't supported by default anymore, update generated test_helper.rb to reflect that
  fix quoting for ActiveSupport::Duration instances
  Add few information on the field types
  Add the options method to action_controller testcase.
2012-07-05 14:03:57 -07:00
François de Metz
0303c2325f Add the options method to action_controller testcase.
Signed-off-by: François de Metz <francois@stormz.me>
2012-07-04 15:00:00 +02:00
Aaron Patterson
b5442b5a3a test should be testing to_param not to_s, remove Array subclass 2012-07-03 16:35:07 -07:00
Bogdan Gusiev
88230b7cf7 AS::Callbacks: deprecate monkey patch code
Deprecate usage of filter object with #before and #after
methods as around callback
2012-06-26 09:21:36 +03:00
Carlos Antonio da Silva
ebe8a45444 Merge pull request #6805 from tim-vandecasteele/uploadedfile-paramify
Don't paramify ActionDispatch::Http::UploadedFile in tests
2012-06-23 13:06:12 -07:00
Tim Vandecasteele
8471edc672 Don't paramify ActionDispatch::Http::UploadedFile in tests
To test uploading a file without using fixture_file_upload, a posted
ActionDispatch::Http::UploadedFile should not be paramified (just like
Rack::Test::UploadedFile).
(Rack::Test::UploadedFile and ActionDispatch::Http::UploadedFile don't
share the same API, tempfile is not accessible on
Rack::Test::UploadedFile as discussed in
https://github.com/brynary/rack-test/issues/30)
2012-06-22 09:27:41 +02:00
Arun Agrawal
6f6111e089 Removed warnings.
1. Change in test name as already defined.
2. ambiguous first argument; put parentheses or 
even spaces
2012-06-21 17:01:57 +05:30
Carlos Antonio da Silva
4d69cdbdd7 Merge pull request #6777 from route/logger_in_metal_tests
Added test for case when view doesn't have logger method when using 
ActionController::Metal controller.
2012-06-19 05:43:07 -07:00
Dmitry Vorotilin
e8f9e667e4 Added test for case when view doesn't have logger method when using ActionController::Metal controller. 2012-06-19 09:45:15 +04:00
James Tucker
0b4e8c8d84 Ensure that cache-control headers are merged
There are several aspects to this commit, that don't well fit into broken down
commits, so they are detailed here:

 * When a user uses response.headers['Cache-Control'] = some_value, then the
   documented convention in ConditionalGet is not adhered to, in this case,
   response.cache_control is ignored due to `return if
   self[CACHE_CONTROL].present?`
 * When a middleware sets cache-control headers that would clobber, they're
   converted to symbols directly, without underscores. This would lead to bugs.
 * Items that would live in :extras if set through expires_in, are placed
   directly in the @cache_control hash, and not respected in many cases
   (somewhat adhering to the aforementioned documentation).
 * Although quite useless, any directive named 'extras' would be ignored.

The general convention applied is that expires_* take precedence, but no longer
overwrite everything and expires_* are ALWAYS applied, even if the header is
set.

I am still unhappy about the contents of this commit, and the code in general.
Ideally it should be refactored to no longer use :extras. I'd likely recommend
expanding @cache_control into a class, and giving it the power to handle the
merge in a more efficient fashion. Such a commit would be a larger change that
could have additional semantic changes for other libraries unless they utilize
expires_in in very standard ways.
2012-06-18 16:49:03 -07:00
kennyj
c42a7a0082 Support unicode character route in config/routes.rb. 2012-06-16 00:22:16 +09:00
Aaron Patterson
b92860fa88 adding a test for #6459 2012-06-14 14:17:06 -07:00
Santiago Pastorino
0e06e8a692 This consider_all_requests_local doesn't make sense
This middleware is only for Public Exceptions.
This follows bd8c0b8a
2012-06-12 13:25:11 -03:00
Santiago Pastorino
bd8c0b8a7a Return proper format on exceptions 2012-06-11 18:07:30 -03:00
Akira Matsuda
edee2c7b3b stop to_sing method names
Module#methods are Symbols in Ruby >= 1.9
2012-06-06 19:33:38 +09:00
Piotr Sarnacki
6525002297 Include routes.mounted_helpers into integration tests
In integration tests, you might want to use helpers from engines that
you mounted in your application. It's not hard to add it by yourself,
but it's unneeded boilerplate. mounted_helpers are now included by
default. That means that given engine mounted like:

    mount Foo::Engine => "/foo", :as => "foo"

you will be able to use paths from this engine in tests this way:

    foo.root_path #=> "/foo"

(closes #6573)
2012-06-01 16:14:08 +02:00
Jeremy Friesen
4791822368 Extracted redirect logic from ActionController::Force::ClassMethods.force_ssl
Prior to this patch the existing .force_ssl method handles both defining
the filter and handling the logic for performing the redirect.

With this patch the logic for redirecting to the HTTPS protocol is
separated from the filter logic that determines if a redirect should
occur.  By separating the two levels of behavior, an instance method
for ActionController (i.e. #force_ssl_redirect) is exposed and available
for more granular SSL enforcement.

Cleaned up indentation.
2012-05-31 12:39:28 -04:00
Sergey Nartimov
1376f4cab1 no need to pass an empty block to button_to helper 2012-05-30 23:02:26 +03:00
Piotr Sarnacki
e4aaac1301 Fix sorting of helpers from different paths
When more than one directory for helpers is provided to a controller, it
should preserver the order of directories. Given 2 paths:

    MyController.helpers_paths = ["dir1/helpers", "dir2/helpers"]

helpers from dir1 should be loaded first. Before this commit, all
helpers were mixed and then sorted alphabetically, which essentially
would require to rename helpers to get desired order.

This is a problem especially for engines, where you would like to be
able to predict accurately which engine helpers will load first.

(closes #6496)
2012-05-28 06:58:48 +02:00
Aaron Patterson
513a0525c2 Merge pull request #2549 from trek/RoutingErrorForMissingControllers
When a route references a missing controller, raise ActionController::RoutingError with clearer message
2012-05-21 11:00:43 -07:00
Andrew White
79b38c386a Escape the extension when normalizing the action cache path.
Although no recognized formats use non-ASCII characters, sometimes they
can be included in the :format parameter because of invalid URLS. To
prevent encoding incompatibility errors we need to escape them before
passing the path to URI.unescape.

Closes #4379
2012-05-20 19:07:05 +01:00
David Chelimsky
dcce01132d Raise Assertion instead of RoutingError for routing assertion failures.
Before this change, assert_recognizes, assert_generates, and
assert_routing raised ActionController::RoutingError when they failed to
recognize the route.

This commit changes them to raise Assertion instead. This aligns with
convention for logical failures, and supports reporting tools that care
about the difference between logical failures and errors e.g. the
summary at the end of a test run.

- Fixes #5899
2012-05-20 06:21:32 -05:00
Dmitry Vorotilin
32a433e1c0 Show in log correct wrapped keys 2012-05-20 09:33:56 +04:00
angelo giovanni capilleri
47570d4f1f mispelling errors in render_text_test.rb and sqlite_specific_schema 2012-05-12 13:19:28 +02:00
Andrew White
e306ca3627 Refactor the handling of default_url_options in integration tests
This commit improves the handling of default_url_options in integration
tests by making behave closer to how a real application operates.

Specifically the following issues have been addressed:

* Options specified in routes.rb are used (fixes #546)
* Options specified in controllers are used
* Request parameters are recalled correctly
* Tests can override default_url_options directly
2012-05-10 20:42:57 +01:00
Kunal Shah
c09a92fb9e Add failing test re #3436 which demonstrates content_type is not respected when using the :head method/shortcut 2012-05-08 03:11:46 -04:00
José Valim
fef110d4a8 Merge pull request #5368 from andhapp/remove-max-stale
Minor test improvement
2012-05-07 07:35:42 -07:00
Steven Soroka
ec4045c02f added an integration test that checks ActionController::UnknownFormat renders 406 :not_acceptable 2012-05-06 00:27:45 -05:00
Steven Soroka
3532200576 Raise a rescuable exception when Rails doesn't know what to do with the format, rather than responding with a head :not_acceptable (406) 2012-05-06 00:27:45 -05:00
José Valim
7a093606f6 Merge pull request #4445 from nragaz/role_based_params_wrapping
specify a role for identifying accessible attributes when wrapping params
2012-05-04 21:45:32 +02:00
Alexey Vakhov
0d19a081ee Improve assert_template layout checking 2012-05-04 23:31:09 +04:00
Alexey Vakhov
4bd05a7bdc Fix assert_template :layout => nil assertion 2012-05-04 23:31:05 +04:00
Alexey Vakhov
df36c5f7ff Fix assert_template assertion with :layout option 2012-05-04 23:31:03 +04:00
Carlos Antonio da Silva
d03aa104e0 Force given path to http methods in mapper to skip canonical action checking
This fixes the following scenario:

    resources :contacts do
      post 'new', action: 'new', on: :collection, as: :new
    end

Where the /new path is not generated because it's considered a canonical
action, part of the normal resource actions:

    new_contacts POST   /contacts(.:format)          contacts#new

Fixes #2999
2012-05-04 15:17:04 -03:00
José Valim
5f62c86b50 Merge pull request #6148 from twinturbo/head-fix
Make ActionController#head pass rack-link
2012-05-03 22:52:08 -07:00
twinturbo
8edd21c66f Remove content-length as well 2012-05-03 17:24:05 -07:00
twinturbo
8eedd1a4a7 Make ActionController#head pass rack-link 2012-05-03 16:18:51 -07:00