Commit Graph

4338 Commits

Author SHA1 Message Date
Rafael Mendonça França
f3e4d2097d Merge pull request #7099 from f1sherman/sweeper-clean-up-if-exception-raised
Clean up Sweeper controller accessor when an Error is raised
2012-07-20 06:30:19 -07:00
Brian John
35fe3107a3 Clean up Sweeper controller accessor when an Error is raised 2012-07-20 05:49:45 -05:00
Andrew White
cabb4471af Don't assume resource param is :id when using shallow routes
Since #5581 added support for resources with custom params we should
not assume that it is :id when using shallow resource routing.
2012-07-20 10:50:38 +01:00
Andrew White
27619e34d4 Support constraints on resource custom params when nesting
The Mapper looks for a :id constraint in the scope to see whether it
should apply a constraint for nested resources. Since #5581 added support
for resource params other than :id, we need to check for a constraint on
the parent resource's param name and not assume it's :id.
2012-07-20 10:50:11 +01:00
Carlos Galdino
fb8a830a32 Remove :confirm in favor of :data => { :confirm => 'Text' } option
This applies to the following helpers:
`button_to`
`button_tag`
`image_submit_tag`
`link_to`
`submit_tag`
2012-07-18 10:32:17 -03:00
Sergey Pchelincev
1b5298e805 add lazy look up in abstract controller's translate method 2012-07-18 10:33:14 +03:00
Dmitry Vorotilin
eb19ca3457 Common behavior with adding formats to lookup_context for TemplateRenderer and PartialRenderer 2012-07-18 10:48:24 +04:00
Andrew White
d8745decaf Add support for optional root segments containing slashes
Optional segments with a root scope need to have the leading slash
outside of the parentheses, otherwise the generated url will be empty.
However if the route has non-optional elements then the leading slash
needs to remain inside the parentheses otherwise the generated url
will have two leading slashes, e.g:

Blog::Application.routes.draw do
  get '/(:category)', :to => 'posts#index', :as => :root
  get '/(:category)/author/:name', :to => 'posts#author', :as => :author
end

$ rake routes
  root GET /(:category)(.:format)              posts#index
author GET (/:category)/author/:name(.:format) posts#author

This change adds support for optional segments that contain a slash,
allowing support for urls like /page/2 for the root path, e.g:

Blog::Application.routes.draw do
  get '/(page/:page)', :to => 'posts#index', :as => :root
end

$ rake routes
root GET /(page/:page)(.:format) posts#index

Fixes #7073
2012-07-17 19:49:44 +01: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
Carl Lerche
afa68eb176 Raise a helpful error message on #mount misuse 2012-07-10 16:17:02 -07:00
Rusty Geldmacher
1a935ad7c6 Fixed bug creating invalid HTML in select options
When a select tag is created for a field with errors, then the inserted
options will errantly have a <div class="field_with_errors"> wrapping
them.
2012-07-10 15:03:37 -04: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
d1c4acc669 Remove AS declarative extension from erb tag test
The extension was removed in 22bc12ec374b8bdeb3818ca0a3eb787dd3ce39d8,
making "test" an alias for minitest's "it".
2012-07-08 20:10:49 -03:00
Carlos Antonio da Silva
9c4afcf4cd Rename RouteInspector to RoutesInspector
Follow the consistency defined in dbc43bc.
2012-07-08 13:49:15 -03:00
@schneems and @mattt
ef91cddb48 move route_inspector to actionpack
this is so we can show route output in the development when we get a routing error. Railties can use features of ActionDispatch, but ActionDispatch should not depend on Railties.
2012-07-07 15:39:49 -05: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
Rafael Mendonça França
7406d69ecc Remove more tests related to draw external routes files
Related with 5e7d6bba79393de0279917f93b82f3b7b176f4b5
2012-06-29 14:33:09 -03: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
dc766c9e7b Move number helper i18n related tests to AS
They also make more sense here since all the related logic with I18n is
handled by AS::NumberHelper, and not by AV anymore.
2012-06-24 19:30:06 -03:00
Carlos Antonio da Silva
feec54b781 Refactor AV number helper tests with invalid numbers
Just make use of the returning exception from assert_raise, instead of
calling the method again with a rescue clause to test the saved
exception number.
2012-06-24 19:30:05 -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
Yehuda Katz
a010fc1800 Merge pull request #6428 from pinetops/resolver_concurrency_fix
Make the Resolver template cache threadsafe
2012-06-21 13:47:18 -07:00
Aaron Patterson
188cc90af9 stop subclassing string 2012-06-21 12:13:13 -07: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
Rafael Mendonça França
bebfa5c62b Merge pull request #6752 from steveklabnik/fix_5680
Respect absolute paths in compute_source_path.
2012-06-16 09:09:38 -07:00
Steve Klabnik
afb053b4d3 Respect absolute paths in compute_source_path.
When using compute_source_path to determine the full path of an
asset, if our source begins with '/', we don't want to include
the directory. Examples are illustrative:

> compute_source_path("foo", "stylesheets", "css")
=> "/Users/steve/src/my_app/public/stylesheets/foo.css"
> compute_source_path("/foo", "stylesheets", "css")
=> "/Users/steve/src/my_app/public/foo.css"

Before this patch, the second example would return the same as the
first.

Fixes #5680.
2012-06-16 18:06:15 +02: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
Aaron Patterson
cd4a0a3332 we raise a subclass of LoadError, so rescue that 2012-06-14 10:40:23 -07:00
Santiago Pastorino
6d7e374c5b Fix build 2012-06-13 20:21:35 -03:00
Santiago Pastorino
459de6fac3 ActionController::Caching depends on RackDelegation and AbstractController::Callbacks 2012-06-13 16:18:03 -03:00
Aaron Patterson
2be40a873e Merge branch 'master-sec'
* master-sec:
  Array parameters should not contain nil values.
2012-06-12 14:25:45 -07:00
Aaron Patterson
24894fc130 Array parameters should not contain nil values. 2012-06-12 14:07:29 -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
ganesh
c74662a27f both string and sumbol will be interpolated as string no need to convert to_s 2012-06-11 22:57:11 +05:30
Akira Matsuda
edee2c7b3b stop to_sing method names
Module#methods are Symbols in Ruby >= 1.9
2012-06-06 19:33:38 +09:00
Akira Matsuda
24889666c7 fix meaningless test case
Module#instance_methods returns an Array of Symbols in Ruby >= 1.9
So this was not actually testing anything
2012-06-06 18:56:49 +09:00
Yuki Nishijima
0ec88cd1c8 accept a block in button helper. 2012-06-05 04:30:40 +09:00