Commit Graph

5112 Commits

Author SHA1 Message Date
Federico Ravasio
0bc95ed95a Raise RuntimeErrors with inspectable and MRI-independent messages.
Previous behaviour was MRI-dependent, now we're making sure the message
is correctly shown: something that can be relyied upon across every
Ruby implementation.
2013-11-24 14:18:00 +01:00
Arun Agrawal
7917a5a5ff Build fix for Routing Inspector
Broken by

6701b4cf41f6f3d9cfc6a93715acbf852d1e468e
2013-11-22 00:45:51 +01:00
Sıtkı Bağdat
6701b4cf41 Fix for routes task
This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
2013-11-21 18:35:58 +02:00
Kuldeep Aggarwal
fc32b7f99b skiping => skipping 2013-11-19 03:08:08 +05:30
Andrey Ognevsky
d04c4fac3b Take Hash with options inside Array in #url_for 2013-11-15 15:50:42 +04:00
Gaurish Sharma
5122bbb3c2 Skip test which is broken on jruby
This test is broken from quite a while & is expected to remain broken as
encoding issues are hardest to fix in JRuby. so lets skip this test for
now
2013-11-09 02:36:24 +05:30
Godfrey Chan
ff1192fea4 Eliminate JSON.{parse,load,generate,dump} and def to_json
JSON.{dump,generate} offered by the JSON gem is not compatiable with
Rails at the moment and can cause a lot of subtle bugs when passed
certain data structures. This changed all direct usage of the JSON gem
in internal Rails code to always go through AS::JSON.{decode,encode}.

We also shouldn't be implementing `to_json` most of the time, and
these occurances are replaced with an equivilent `as_json`
implementation to avoid problems down the road.

See [1] for all the juicy details.

[1]: intridea/multi_json#138 (comment)
2013-11-05 22:26:45 -08:00
Guillermo Iguaran
f886fe2d8c Revert "Merge pull request #9660 from sebasoga/change_strong_parameters_require_behaviour"
This reverts commit c2b5a8e61ba0f35015e6ac949a5c8fce2042a1f2, reversing
changes made to 1918b12c0429caec2a6134ac5e5b42ade103fe90.

See: https://github.com/rails/rails/pull/9660#issuecomment-27627493
2013-11-02 14:30:03 -05:00
Guillermo Iguaran
c2b5a8e61b Merge pull request #9660 from sebasoga/change_strong_parameters_require_behaviour
Change ActionController::Parameters#require behavior when value is empty
2013-11-01 17:28:05 -07:00
Damien Mathieu
38f8872aa5 session#fetch doesn't behave exactly like Hash#fetch.
Mention it in the changelog and add a test checking for regressions.

Hash#fetch isn't adding the defaultly returned value.
However, in the session, saving it is the behavior we should expect.

See discussion in #12692
2013-10-30 15:04:22 +01:00
Damien Mathieu
84c9f4164b add the fetch method to sessions 2013-10-29 20:37:15 +01:00
Doug Cole
7171111d3a don't mutate hash with fetch 2013-10-26 19:22:31 -07:00
Caleb Spare
cd78d72526 Make remote_ip detection properly handle private IPv6 addresses
Fixes #12638.
2013-10-26 12:28:44 -07:00
Tima Maslyuchenko
719f1d68e4 pass app config to controller helper proxy
After this fix application config become available when calling helper outisde of view

config/application.rb

    #...
    config.asset_host = 'http://mycdn.com'
    #...

Somewhere else

    ActionController::Base.helpers.asset_path('fallback.png')
    # => http://mycdn.com/assets/fallback.png
2013-10-24 08:03:31 +03:00
Josh Symonds
cb81a535e0 Correct error in Utils.normalize_path that changed paths improperly 2013-10-23 16:44:23 -05:00
Thiago Pradi
25b0076eba Removing unused fake models from actionpack tests 2013-10-16 00:51:57 -03:00
Andrew White
9dbd208562 Respect SCRIPT_NAME when using redirect with a relative path
Example:
    # application routes.rb
    mount BlogEngine => '/blog'

    # engine routes.rb
    get '/admin' => redirect('admin/dashboard')

This now redirects to the path `/blog/admin/dashboard`, whereas before it
would've generated an invalid url because there would be no slash between
the host name and the path. It also allows redirects to work where the
application is deployed to a subdirectory of a website.

Fixes #7977
2013-10-10 13:03:26 +01:00
BlueHotDog
8642c2aadc Fixing repond_with working directly on the options hash
This fixes an issue where the respond_with worked directly with the given
options hash, so that if a user relied on it after calling respond_with,
the hash wouldn't be the same.

Fixes #12029
2013-10-09 12:36:26 +03:00
Rafael Mendonça França
37c721aa83 Merge pull request #12354 from kennyj/fix_12293
Closes #12293. Strong parameters should permit nested number as key.
2013-09-28 17:31:24 -07:00
Yves Senn
00fc9684d4 Merge pull request #12233 from claudiob/delete-actionpack-unused-fixture
Remove HelperyTestHelper not used in any test
2013-09-27 04:49:20 -07:00
kennyj
277918e61a Strong parameters should permit nested number as key. Closes #12293 2013-09-27 03:53:45 +09:00
Sam Ruby
ac1613e5df add test_scoped_root_as_name
test for regression introduced by https://github.com/rails/rails/pull/9155
2013-09-24 09:45:36 -04:00
Derek Prior
1dacfbabf3 Fix incorrect assert_redirected_to failure message
In some instances, `assert_redirected_to` assertion was returning an
incorrect and misleading failure message when the assertion failed.
This was due to a disconnect in how the assertion computes the redirect
string for the failure message and how `redirect_to` computes the
string that is actually used for redirection.

I made the `_compute_redirect_to_loaction` method used by `redirect_to`
public and call that from the method `assert_redirect_to` uses to
calculate the URL.

The reveals a new test failure due to the regex used by
`_compute_redirect_to_location` allow `_` in the URL scheme.
2013-09-19 09:23:20 -04:00
Jonathan Baudanza
0f3124dd85 NullSessionHash#destroy should be a no-op
Previously it was raising a NilException
2013-09-18 19:01:59 -07:00
kennyj
0cc6508120 Fix an issue where router can't recognize downcased url encoding path. 2013-09-19 02:43:22 +09:00
claudiob
6aa641f63e Remove HelperyTestHelper not used in any test
HelperyTestHelper was introduced in 66ef922 by @josevalim
to pair with HelperyTestController. This test controller was
later removed in e10a253 by @strzalek, leaving HelperyTestHelper unused
2013-09-14 10:40:28 -07:00
Ricardo de Cillo
1413ee991c Custom flash should be defined only for the class that defines it and it's subclasses. 2013-09-13 10:19:29 -03:00
Rafael Mendonça França
b3a9cac18f Merge pull request #12159 from nashby/issue-12149
do not break params filtering on nil values
2013-09-12 15:20:09 -07:00
Anupam Choudhury
08286ba171 Removed semicolon and added space 2013-09-13 01:22:53 +05:30
Akira Matsuda
b1116bdcc3 Reset ActionView::Base.logger instead of AC::Base.logger
see: 9b0ac0bc74569db460f87ea6888b3847be0ff5be
2013-09-10 19:47:04 +02:00
Santiago Pastorino
a46fa8df06 Make AC standalone rendering work 2013-09-10 11:01:12 -03:00
claudiob
61d2391352 Remove helper fixtures not used in any test
The fixture for module AbcHelper defines three functions bare_a,
bare_b and bare_c, but only bare_a is used in the code that tests
helper functions.
2013-09-09 14:19:09 -07:00
Vasiliy Ermolovich
1d375e59f1 do not break params filtering on nil values
closes #12149
2013-09-07 15:16:45 +03:00
Alvaro Redondo
228d2b1e93 Add regression test for IpSpoofAttackError issue
See #10780
2013-09-03 18:29:40 +02:00
Łukasz Strzałkowski
40fcb9e822 Revert "Port all remaining self.protected_instance_variables to class methods"
This reverts commit 7de994fa215e9f4c2856d85034bc4dd7b65d0c01.
2013-09-02 23:18:02 +02:00
Rafael Mendonça França
0329bab9d4 Merge pull request #11912 from jonkessler/respond-to-signature-fixes
Update Rails::Railtie::Configuration and ActionDispatch::Response#respond_to? to accept include_private argument
2013-08-31 14:41:14 -07:00
Łukasz Strzałkowski
7de994fa21 Port all remaining self.protected_instance_variables to class methods 2013-08-29 12:13:45 +02:00
Łukasz Strzałkowski
e10a25310f Move abstract's controller tests to AV
The ones that were actually testing AV functionality and should belong in there
2013-08-25 11:40:11 +02:00
Łukasz Strzałkowski
a2ca04bb3a Extend basic rendering, test it in railties 2013-08-25 11:40:10 +02:00
Łukasz Strzałkowski
313f1f196a Basic rendering test 2013-08-25 11:39:14 +02:00
Łukasz Strzałkowski
1e001b1db3 Move AP's capture tests to AV 2013-08-25 11:39:14 +02:00
Łukasz Strzałkowski
c9ef9c1442 Move remaining layouts tests to AV 2013-08-25 11:39:14 +02:00
Łukasz Strzałkowski
1538395d4c Remove unused fixtures and models from AP tests 2013-08-25 11:39:14 +02:00
Łukasz Strzałkowski
acc8e25902 Move render_test to AV 2013-08-25 11:39:13 +02:00
Łukasz Strzałkowski
d1760253f5 Load AV::Layout to AM::Base in railties 2013-08-25 11:39:11 +02:00
Łukasz Strzałkowski
21c5f2845d Remove RenderERBUtils from AP (only AV use it) 2013-08-25 11:39:10 +02:00
Łukasz Strzałkowski
37d77f6b9d Remove AV::TestCase from AP 2013-08-25 11:39:10 +02:00
Łukasz Strzałkowski
3fd2e72477 Load AV::Layouts dynamicly via railties 2013-08-25 11:39:10 +02:00
Łukasz Strzałkowski
8e3413d410 Create AbstractController::Rendering interface
This interface should be use when implementing renderers.
2013-08-25 11:39:09 +02:00
Łukasz Strzałkowski
8c2c95e5d2 Fix AP test suite after moving stuff to AV 2013-08-25 11:39:08 +02:00
Łukasz Strzałkowski
1b446d06dd Move view_paths from AP to AV 2013-08-25 11:39:07 +02:00
Kir Shatrov
a725a453b3 Display exceptions in text format for xhr request 2013-08-22 22:20:34 +04:00
Santiago Pastorino
f97fdace54 Merge pull request #11443 from wangjohn/sse_reloader_class
SSE class for ActionController::Live
2013-08-19 07:30:27 -07:00
Ben Woosley
f84c6201dd Fail informatively in #respond_with when no appropriate #api_behavior renderer is available.
Currently if a user calls #respond_with(csvable), but has not csv
renderer available, Responder will just run through the default render
behavior twice, raising ActionView::MissingTemplate both times.

This changes ActionController::Metal::Responder#api_behavior to check
in advance whether there is a renderer available, and raise
ActionController::MissingRenderer if not.
2013-08-17 19:03:45 -07:00
Ben Woosley
6776980b96 Split the 1200+ line mime_responds_test into 3 more focused and manageable test files. 2013-08-17 19:01:53 -07:00
Vijay Dev
9abe72c760 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	actionview/README.rdoc
	activerecord/lib/active_record/migration.rb
	guides/source/development_dependencies_install.md
	guides/source/getting_started.md
2013-08-17 21:49:16 +05:30
Vijay Dev
ec8ef1e105 Revert "Merge branch 'master' of github.com:rails/docrails"
This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing
changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9.

Seems to be a code merge done by mistake.
2013-08-17 21:46:39 +05:30
Jon Kessler
ba5fab4c01 update Rails::Railtie::Configuration and ActionDispatch::Response#respond_to? to accept include_private argument 2013-08-16 08:22:08 -07:00
Nicholas Jakobsen
55cbb85fb7 Execute conditional procs on controller filters only for current action.
:only and :except options for controller filters are now added before
:if and :unless. This prevents running :if and :unless procs when not
on the specified. Closes #11786.
2013-08-10 09:13:20 -07:00
Gaurish Sharma
28348e0681 Add timeout to test_async_stream
Without timeout:
this test executed infinitely on JRuby
Passes on MRI

With Timeout:
this test gracefully fails on JRuby
Passes on MRI, tested on v2.0 & v1.9.3
2013-08-02 20:27:28 +05:30
wangjohn
d2d6aef510 Creating an SSE class to be used with ActionController::Live. 2013-07-30 03:23:01 -04:00
Akira Matsuda
fb97a7d87b Reset ActionView::Base.logger instead of AC::Base.logger
see: 9b0ac0bc74569db460f87ea6888b3847be0ff5be
2013-07-26 03:01:27 +09:00
Akira Matsuda
d9f1542fd3 Fix order dependent tests
Reset ActionView::Base.logger after tests
2013-07-26 03:01:26 +09:00
Akira Matsuda
24869e38af Fix order dependent AP test
any_instance.stubs + unstub with Mocha doesn't restore the original status in the following case,
so we need to undef Customer#to_json before every test

require 'test/unit'
require 'mocha/setup'

module M
  def foo() :foo; end
end

class C
  include M

  undef_method :foo
end

C.any_instance.stubs(:foo).returns(:mocha)

C.any_instance.unstub(:foo)
2013-07-26 03:01:26 +09:00
Andrew White
4db0637d55 Allow overriding of all headers from passed environment hash
Allow REMOTE_ADDR, HTTP_HOST and HTTP_USER_AGENT to be overridden from
the environment passed into `ActionDispatch::TestRequest.new`.

Fixes #11590
2013-07-25 07:54:57 +01:00
Andrew White
74722d66d3 Fix failing test missed for the past year :(
When optimized path helpers were re-introduced in d7014bc the test added
in a328f2f broke but no-one noticed because it wasn't being run by the
test suite.

Fix the test by checking for nil values or empty strings after the args
have been parameterized.
2013-07-17 08:56:34 +01:00
Andrew White
1555a1800e Skip Rack applications and redirects when generating urls
When generating an unnamed url (i.e. using `url_for` with an options
hash) we should skip anything other than standard Rails routes otherwise
it will match the first mounted application or redirect and generate a
url with query parameters rather than raising an error if the options
hash doesn't match any defined routes.

Fixes #8018
2013-07-16 13:39:17 +01:00
Arun Agrawal
ceb57c5148 Removed unused file! Moved to actionview
Removed unused file as this has been
moved to actionview
2013-07-13 18:44:28 +02:00
Yves Senn
3af7b16c11 add test-case to verify error.path when a helper was not found.
This verifies the code added with:
99c9d18601
2013-07-12 15:40:47 +02:00
Yves Senn
5bee14f3a4 move MissingHelperError out of the ClassMethods module. 2013-07-12 15:34:29 +02:00
Marc Schütz
90e420e406 Remove accidentally committed vi .swp file. 2013-07-10 16:06:40 +02:00
Piotr Niełacny
e0438b1c07 Show real LoadError on helpers require
When helper try to require missing file rails will throw exception about
missing helper.

  # app/helpers/my_helper.rb

  require 'missing'

  module MyHelper
  end

And when we try do load helper

  class ApplicationController
    helper :my
  end

Rails will throw exception. This is wrong because there is a helper
file.

  Missing helper file helpers/my_helper.rb

Now when helper try to require non-existed file rails will throw proper
exception.

  No such file to load -- missing
2013-07-10 11:26:43 +02:00
Paul Nikitochkin
f6746c0245 Use Request#raw_post instead Request#body
In order to get raw_post to be not empty after
ParamsParser#parse_formatted_parameters,
added rewinding of body stream input on parsing json params.

Closes #11345
2013-07-08 01:48:35 +03:00
Rafael Mendonça França
239126385f Merge pull request #11313 from gsamokovarov/url-encoded-params-test
Cleanup ul_encoded_params_parsing_test
2013-07-06 16:09:36 -07:00
Genadi Samokovarov
3db80b5496 Cleanup ul_encoded_params_parsing_test 2013-07-05 16:35:19 +03:00
Yamagishi Kazutoshi
ce89251bb2 Space is not required for Set-Cookie header 2013-07-05 15:40:14 +09:00
Francesco Rodriguez
fa45401b82 Remove page_cache_extension deprecated method 2013-07-01 22:09:11 -05:00
Aaron Patterson
3f81230a72 use bytesize rather than force encoding 2013-06-28 17:21:38 -07:00
Xavier Defrang
9fd0c605b9 Verify that route constraints respond to the expected messages instead of silently failing to enforce the constraint 2013-06-28 15:54:48 +02:00
kennyj
db0499a6b6 Re-remove deprecated API. 2013-06-28 01:42:07 +09:00
Carlos Antonio da Silva
dd9d869746 Merge pull request #11000 from sbeckeriv/accept_header
Fix undefined method `ref' for nil:NilClass for bad accept headers
2013-06-25 19:34:20 -03:00
Yves Senn
55d9176b4a test-case => failing 2013-06-25 05:52:07 +01:00
Guillermo Iguaran
d6bc2fa5a9 Merge pull request #11069 from ykzts/actiondispatch-ssl-secure-flag-igonore-case
Flag cookies as secure with ignore case in ActionDispatch::SSL
2013-06-24 14:24:03 -07:00
Yamagishi Kazutoshi
891fd78cd7 Flag cookies as secure with ignore case in ActionDispatch::SSL 2013-06-24 18:01:30 +09:00
Geoff Buesing
d8bf1f22de ActionDispatch:SSL: don't include STS header in non-https responses 2013-06-23 20:01:20 -05:00
Piotr Sarnacki
50311f1391 Don't remove trailing slash from PATH_INFO for mounted apps
Previously when app was mounted as following:

    class Foo
      def call(env)
        [200, {}, [env['PATH_INFO']]]
      end
    end

    RackMountRailsBug::Application.routes.draw do
      mount RackTest.new => "/foo"
    end

trailing slash was removed from PATH_INFO. For example requesting

    GET /foo/bar/

on routes defined above would result in a response containing "/foo/bar"
instead of "/foo/bar/".

This commit fixes the issue.

(closes #3215)
2013-06-21 08:56:19 +02:00
Łukasz Strzałkowski
3fbc89a86b Remove digestor fixtures from AP
They were moved to actionview/ and are not used in actionpack
2013-06-20 17:23:16 +02:00
Piotr Sarnacki
f12109448b Remove unneeded test fixtures in AV 2013-06-20 17:23:16 +02:00
Piotr Sarnacki
5e5bf31b4a Remove unneeded files 2013-06-20 17:23:16 +02:00
Piotr Sarnacki
eb23754ebb Move template tests from actionpack to actionview 2013-06-20 17:23:16 +02:00
Stephen Becker IV
8ffd139edd Fix undefined method `ref' for nil:NilClass for bad accept headers 2013-06-19 06:29:52 -07:00
dtaniwaki
c91e1cca43 Added test for link_to_unless to make sure the result consistency. 2013-06-16 22:28:49 -04:00
David Celis
8fc3427646 Use a case insensitive URI Regexp for #asset_path
Context: https://gist.github.com/radar/5793814

The `URI_REGEXP` that various AssetUrl helpers use is currently case
sensitive when checking for a URI scheme. This means if you try to pass
a URL like `HTTP://www.example.com/path/to/image.jpg`, you end up with
a bogus asset path: `/assets/HTTP://www.example.com/path/to/image.jpg`.

URLs are case insensitive, so this regexp should be as well.

Signed-off-by: David Celis <me@davidcel.is>
2013-06-16 16:57:49 -07:00
Vasiliy Ermolovich
782cee5377 collection tags accept html attributes as the last element of collection 2013-06-16 17:58:34 +03:00
Alex Peattie
a89bdc04ba Update the HTML boolean attributes per the HTML 5.1 spec
- Add attributes `allowfullscreen`, `default`, `inert`, `sortable`,
`truespeed`, `typemustmatch`.
- Fix attribute `seamless` (previously misspelled `seemless`).
- Use `assert_dom_equal` instead of `assert_equal` in test.
2013-06-14 23:47:21 +01:00
Guillermo Iguaran
934369f529 Don't set X-UA-Compatible header by default
We are setting this header to chrome=1 for Chrome Frame and this will be
retired soon. Check http://blog.chromium.org/2013/06/retiring-chrome-frame.html for
details
2013-06-13 14:56:02 -05:00
Arun Agrawal
260b234740 Warning removed for Minitest 2013-06-12 13:20:43 +02:00
Drew Ulmer
2a576dd257 Fix mismatching variable names when using an underscore
The ERBTracker template digest helper class was using a regex to match
render calls and it was incorrectly not matching against variables with
underscores in the name. This caused it to use the wrong regex match data
to populate the template dependency. Because underscore is a valid
character for a variable, this fixes the ERBTracker to match it properly.
2013-06-04 14:39:50 -05:00
kennyj
bc5314a102 Raise ArgumentError to fix Rails 4.1 deprecation warn message. 2013-06-02 00:39:11 +09:00
kennyj
74f2b41ce0 Remove Mime::Type#verify_request? and Mime::Type.browser_generated_types were deprecated. 2013-06-02 00:07:58 +09:00
kennyj
d3e8c149cb Remove ActionView::Template#mime_type was deprecated. 2013-06-01 23:22:12 +09:00
kennyj
d8c6f52d3b Remove ActionController::RecordIdentifier was deprecated. 2013-06-01 23:22:12 +09:00
kennyj
cb8348b56f Remove :confirm and :disable_with options from ActionView::Helpers::FormTagHelper were deprecated. 2013-06-01 23:22:01 +09:00
kennyj
825f4df23c Remove link_to_function / button_to_function from ActionView::Helpers::JavascriptHelper were deprecated. 2013-06-01 23:17:27 +09:00
kennyj
8b80d72327 Remove :confirm and :disable_with options for ActionView::Helpers::UrlHelper#link_to and #button_to were deprecated. 2013-06-01 23:17:16 +09:00
Yves Senn
88e8e951a2 RoutesInspector deals with routes using regexp as :controller option 2013-05-30 08:39:57 +02:00
Arun Agrawal
5eaa30e47c Running isolated tests
These stopped running don't know when. 
But these should be running now.
2013-05-28 19:59:55 +02:00
José Valim
378ea96905 Add has_named_route? to the mapper API 2013-05-20 20:46:04 +02:00
schneems
ba0695f48a Fix named routing regression from 3.2.13
When named route that is nested is used in 3.2.13

Example `routes.rb`:

```
resources :nested do
  resources :builder, :controller => 'nested/builder'
end
```

In 3.2.12 and 3.2.12 this named route would work:

```
nested_builder_path(:last_step, :nested_id => "foo")
```

Generating a url that looks like `/nested/foo/builder/last_step`. This PR fixes the regression when building urls via the optimized helper. Any explicit keys set in the options are removed from the list of implicitly mapped keys.

Not sure if this is exactly how the original version worked, but this fixes this use case regression.
2013-05-16 18:42:15 -03:00
Rafael Mendonça França
c9d75e0814 Revert "Integration tests support the OPTIONS http method"
This reverts commit ad46884af567d6f8d6d8d777f372c39e81a560ba.

Conflicts:
	actionpack/CHANGELOG.md
	actionpack/lib/action_dispatch/testing/integration.rb
	actionpack/test/controller/integration_test.rb

Reason: It will conflict with a lot of test cases. Better to call
`process` directly since this is a very uncommon HTTP method.

Fixes #10638.
2013-05-16 14:41:36 -03:00
Rafael Mendonça França
4eb16e7a06 Merge pull request #10636 from seanwalbran/fix-asset-host-proc-returning-nil
fix rails4 regression with asset_host Proc returning nil
2013-05-16 09:42:41 -07:00
Rafael Mendonça França
6a4ff5cc09 Revert "Add the options method to action_controller testcase."
This reverts commit 0303c2325fab253adf5e4a0b738cb469c048f008.

Conflicts:
	actionpack/lib/action_controller/test_case.rb

REASON: It will conflict with a lot of test cases. Better to call
`process` directly since this is a very uncommon HTTP method.

Fixes #10638.
2013-05-16 11:10:59 -03:00
Aaron Patterson
9db6e63bfb Merge pull request #10591 from acapilleri/cond_callback_test
add test for skip_before_filter with condition
2013-05-15 17:45:50 -07:00
Sean Walbran
122ac9fd46 restore ability to return nil from asset_host proc, add test 2013-05-15 09:07:46 -05:00
Aaron Patterson
8ece52f731 use public api for testing rather than grabbing instance variables 2013-05-14 14:11:03 -07:00
Angelo capilleri
8da819eef5 add test for skip_before_filter with condition 2013-05-13 16:10:53 +02:00
Erik Michaels-Ober
ce4456fde6 Replace multi_json with json 2013-05-11 21:43:48 -07:00
Jeremy Kemper
5e03239d59 Fix that JSON and XML exception responses should give the HTTP error message for their status, by default, not the message from the underlying exception 2013-05-08 21:28:50 -07:00
Brandon Keepers
ca0275d36b Test that #fresh_when accepts an array
https://github.com/rails/etagger/pull/3
2013-05-07 11:04:44 -03:00
Bryan Ricker
3c516c4b52 Allow numbers in partial name for digesting
Add failing test for template with number at the end

Use \w for RENDER_DEPENDENCY regex

Spacing

Add CHANGELOG entry
2013-05-06 18:30:29 -07:00
Carlos Antonio da Silva
630d2e4e38 Fix failing AP test 2013-05-01 10:48:01 -03:00
Aaron Patterson
fd890f6aea Merge pull request #9857 from yyyc514/bad_params_should_400
failure to parse params should trigger a 400 Bad Request
2013-04-30 17:38:56 -07:00
Rafael Mendonça França
faa2c71dee Revert "Merge pull request #10337 from eimermusic/fix_template_digestor_lookup"
This reverts commit b4239622afc4f3f73808fd0c97512f3a534e07dd, reversing
changes made to f99ce3c188f5dde57e2ff63e6a22363c62f0a4cd.

Reason: This broke the build
https://travis-ci.org/rails/rails/jobs/6629894
2013-04-25 11:14:22 -03:00
Rafael Mendonça França
b4239622af Merge pull request #10337 from eimermusic/fix_template_digestor_lookup
Fix ActionView::Digestor to correctly pass format to LookupContext

Conflicts:
	actionpack/CHANGELOG.md
2013-04-25 10:22:51 -03:00
Andrew White
f99ce3c188 Add support for extra options to force_ssl
This commit adds support for passing additional url options along
with a :status option and any of the flash-related options to
`redirect_to` (i.e. :flash, :alert & :notice).

Closes #7570.
2013-04-25 13:45:52 +01:00
Martin Westin
9a79c13c45 AV Digestor correctly passes format to LookupContext
ActionView::Digestor now passes arguments correctly to
LookupContext::find method. This makes cache digests
respect the format option correctly.

FixtureFinder in tests also changed to reflect this.
2013-04-25 09:52:04 +02:00
Andrew White
8227bf7ee9 Use request.fullpath to build redirect url in force_ssl
The `force_ssl` command now builds the redirect url from `request.fullpath`.
This ensures that the format is maintained and it doesn't redirect to a route
that has the same parameters but is defined earlier in `routes.rb`. Also any
optional segments are maintained.

Fixes #7528.
Fixes #9061.
Fixes #10305.
2013-04-25 08:33:21 +01:00
Andrew White
00e5453e20 Add test for format: false with resources - closes #10323 2013-04-24 13:05:25 +01:00
Lewis Marshall
ec462b4de7 Return a 405 response for unknown HTTP methods 2013-04-22 14:31:10 +01:00
wangjohn
6ec28f8cc0 Removing tests for deprecated options in active support. The
+use_full_path+ option was removed in 3b3790a4 and passing the template
handler to render was deprecated in 43d27e91.
2013-04-21 11:07:26 -04:00
Andrew White
0883f9f508 Refactor ActionDispatch::Http::URL.build_host_url
Add support for extracting the port from the :host option and for
removing the subdomain by using nil, false or ''.
2013-04-18 17:12:40 +01:00
Andrew White
c102440917 Add url generation tests for #10185 2013-04-18 17:12:40 +01:00
Derek Watson
6183e1a460 Passing subdomain: '' to url_for removes the subdomain (instead of adding a leading .)
Adding a boolean route constraint checks for presence/absence of request property
2013-04-18 17:12:40 +01:00
printercu
14c196e5a3 Avoid leak into controller's action_methods 2013-04-18 20:03:31 +04:00
Vasiliy Ermolovich
0778290b57 options_from_collection_for_select helper takes html attributes
as the last element of the array
2013-04-11 14:15:33 +03:00
Rafael Mendonça França
63f7356b3a Merge pull request #9604 from sgrif/live_streaming_exceptions
Exceptions raised when using ActionController::Live cause server crash
2013-04-08 09:53:20 -07:00
Ryan McGeary
48dc5192ef Fix explicit names on multiple file fields
If a file field tag is passed the multiple option, it is turned into an
array field (appending "[]"), but if the file field is passed an
explicit name as an option, leave the name alone (do not append "[]").

Fixes #9830
2013-04-05 15:32:56 -04:00
Carlos Antonio da Silva
bbfddf8470 Fix indent and remove extra white spaces 2013-04-05 09:59:22 -03:00
Carlos Antonio da Silva
e936cf9c47 Ensure mail_to helper does not modify the given html options hash 2013-04-04 21:25:47 -03:00
Carlos Antonio da Silva
aa3b6837b2 Merge pull request #10065 from spohlenz/mail_to_block
Add block support for the mail_to helper
2013-04-04 17:20:37 -07:00
Carlos Antonio da Silva
f5644b0cd6 Fix typo in view name
Introduced in 2c22376fe04b89e8f34620139720b85a85ce3428
2013-04-03 21:02:26 -03:00
Rafael Mendonça França
b3efea8a6d Merge pull request #10074 from trevorturk/remove-fixme-comments-about-legacy-key-generator
Remove comments about removing LegacyKeyGenerator in 4.1
2013-04-03 07:00:21 -07:00
Andrew White
148b9ccbb5 Merge pull request #9932 from senny/9913_routing_problem
routing bugfixes when matching multiple paths
2013-04-03 06:48:04 -07:00
Trevor Turk
2edf657a64 Remove comments about removing LegacyKeyGenerator in 4.1 2013-04-03 08:28:37 -05:00
Yves Senn
33971922b3 fix regression in Mapper when format: was used in a scope.
Closes #10071

`#normalize_path!` depends on the options so we need to call
`#normalize_options!` first to make sure everything is set correctly.
2013-04-03 15:01:01 +02:00
Sam Pohlenz
4bb26dd7b2 Add block support for the helper 2013-04-03 14:42:48 +10:30
Steve Klabnik
c9a92a247d Getting rid of a few other vestiges of rails.png.
We don't actually need a rails.png in the AP fixtures, the tests
that use it don't actually try to load the file.

We also don't need to get rid of it with the dummy reset either.

Finally, it's not needed in the sample application that's included
with the Rails Guides.
2013-04-02 17:44:46 -07:00
Santiago Pastorino
ac6fc60621 Merge pull request #10061 from trevorturk/dummy-key-generator-rename
Rename DummyKeyGenerator -> LegacyKeyGenerator
2013-04-02 17:02:02 -07:00
Trevor Turk
7c7a427344 Rename DummyKeyGenerator -> LegacyKeyGenerator 2013-04-02 18:41:57 -05:00
Trevor Turk
c0b1eb112f Fix permanent cookie jar accessor typo 2013-04-02 18:20:24 -05:00
Vipul A M
0beec244e7 each_with_index => each as we dont use index 2013-04-03 00:36:16 +05:30
KalabiYau
6de92c8729 Fixed typo on AP dispatch Mime::Type test 2013-04-01 23:25:15 +04:00
Santiago Pastorino
f9d23b3848 Merge pull request #9978 from trevorturk/cookie-store-auto-upgrade
Cookie-base session store auto-upgrade
2013-04-01 08:10:34 -07:00
Carlos Antonio da Silva
0a16cf19c2 Merge pull request #9680 from bdmac/time-zone-options-revert-grep-to-select
Revert grep to select since they are not the same
2013-03-31 15:46:48 -07:00
Santiago Pastorino
31216ec84b Merge pull request #10013 from vipulnsward/fix_request_method_test
fix request methods test
2013-03-31 12:36:39 -07:00
Vipul A M
d0b8f4c309 fix request methods test 2013-03-31 22:11:23 +05:30
Vipul A M
f23e7eba52 remove unused variable and assignment 2013-03-31 19:34:40 +05:30
Carlos Antonio da Silva
0c5552a3dd Fix typos in AP: "overriden" => "overridden" 2013-03-30 15:17:08 -03:00
Trevor Turk
274a3aa64c Allow transparent upgrading of legacy signed cookies to encrypted cookies; Automatically configure cookie-based sessions to use the best cookie jar given the app's config 2013-03-28 14:38:36 -05:00
Anupam Choudhury
d18e8b1a38 Refactored to remove unused variable 2013-03-28 15:58:03 +05:30
Brian McManus
53d68bd964 Add regression test for TZ grep
Added a regression test that will fail if anyone tries to change
time_zone_select to use grep again thinking it will work when it does
not.
2013-03-27 14:10:25 -07:00
Brian McManus
1cc991bef8 Revert grep to select since they are not the same
A previous commit swapped out a call to select for a call to grep in
time_zone_options_for_select. This behavior actually causes the
regexp priority option to stop working.

ActiveSupport::TimeZone overrides the =~ operator which is what the
select block was using previously. Enumerable#grep
checks pattern === element and in this case that would be /US/ ===
ActiveSupport::TimeZone which does not work because
ActiveSupport::TimeZone does not supply an implicit converting to_str
method, only an explicit to_s method.

It would be impossible to provide a to_str method that behaves
identically to the =~ method provided on ActiveSupport::TimeZone
so the only option is to revert back to using select with =~.
2013-03-27 14:10:25 -07:00
Rafael Mendonça França
e7438501d6 Merge pull request #8458 from lucisferre/improve-layout-override-fallback-behavior
Provides standard layout lookup behavior for method and proc cases

Conflicts:
	actionpack/CHANGELOG.md
2013-03-27 16:09:12 -03:00
Chris Nicola
ef27bba63d Provides standard layout lookup behavior for method and proc cases
When setting the layout either by referencing a method or supplying a
Proc there is no way to fall back to the default lookup behavior if
desired. This patch allows fallback to the layout lookup behavior when
returning nil from the proc or method.
2013-03-27 10:59:50 -07:00
Yves Senn
69e87f5994 routing shorthand syntax works with multiple paths
Closes #9913.

We need to expand the match shorthand syntax for every path.
2013-03-26 12:30:25 +01:00
Yves Senn
d5f4cac68c bugfix, when matching multiple paths with get, post, ...
This problem was introduced with:

d03aa104e0
2013-03-26 12:14:21 +01:00
Arun Agrawal
d67f761a9e Skipping test for OpenSSL::PKCS5 JRuby 2013-03-25 11:01:01 +01:00
Jeremy Kemper
32ec8eb91d Update tests for #9704, named route collisions
* Fix named route collision in mount test fixture
* Update controller named route precedence test
2013-03-24 23:30:44 -07:00
Trevor Turk
0190cba99c Introduce UpgradeLegacySignedCookieJar to transparently upgrade existing signed cookies generated by Rails 3 to avoid invalidating them when upgrading to Rails 4 2013-03-24 18:20:24 -05:00
Jeremy Kemper
822dd1340d Merge pull request #9704 from trevorturk/warn-about-skipped-routes
Raise an ArgumentError when a clashing named route is defined
2013-03-24 12:55:43 -07:00
Prathamesh Sonpatki
ba7c9d76af Changed 'args' to 'arguments' in test description 2013-03-24 02:27:43 +05:30
Josh Goebel
ea2336b9e2 failure to parse params should trigger a 400 Bad Request 2013-03-21 14:23:46 -04:00
Rafael Mendonça França
066907d1cb Merge pull request #9802 from newsline/fix-broken-action-missing
Fix missing action_missing

Conflicts:
	actionpack/CHANGELOG.md
2013-03-20 18:14:41 -03:00
Janko Luin
0dfa6cb97c Fix broken ActionController#action_missing
A recent change introduced the assumption that all controller actions
are known beforehand, which is not true when using action_missing.
2013-03-20 08:20:54 +01:00
Trevor Turk
a2b7c0e69d Raise an ArgumentError when a clashing named route is defined 2013-03-19 23:23:55 -05:00
schneems
334549b4a5 Fix improperly configured host in generated urls
If the host in `default_url_options` is accidentally set with a protocol such as 

```
host: "http://example.com"
``` 

then the generated url will have the protocol twice `http://http://example.com` which is not what the user intended. Likely they wanted to define a host `host: "example.com"` and a `protocol: "http://"` but did not know the convention.

This may not the most common problem, but when it happens it can go undetected for a while. I accidentally added `http://` out of habit recently only to find all the links in my emails were broken after deploying a demo site to production. Rather than allow this accident go undetected, we can fix the problem in line by properly setting the protocol and host.


I was able to find this related question on stack overflow: http://stackoverflow.com/questions/5878329/rails-3-devise-how-do-i-make-the-email-confirmation-links-use-secure-https-n where the answer was highly upvoted.

This is based off of work in #7415 cc/ @pixeltrix

ATP Action Mailer and Action Pack
2013-03-19 12:34:49 -05:00
Brad Dunbar
95332abe09 Digest auth should not 500 when given a basic header. 2013-03-18 14:50:47 -04:00
Aaron Patterson
2392535f40 Merge branch 'master-sec'
* master-sec:
  fix protocol checking in sanitization [CVE-2013-1857]
  JDOM XXE Protection [CVE-2013-1856]
  fix incorrect ^$ usage leading to XSS in sanitize_css [CVE-2013-1855]
  stop calling to_sym when building arel nodes [CVE-2013-1854]
2013-03-18 10:17:32 -07:00
Sean Griffin
c01d080fd6 Exception handling for controllers using ActionController::Live
Any exceptions that occured at the view or controller level for a
controller using ActionController::Live would cause the server to either
hang with an open socket indefinitely, or immediately crash (depending
on whether the server was launched with rails s or directly). Changed
the behavior of exceptions to act the same as streaming templates for
html requests, and allow for an on_error callback if needed.
2013-03-18 10:41:24 -06:00
Carlos Antonio da Silva
eb32b3659d Merge pull request #9753 from jbarreneche/bug/render-locale-fallbacks
i18n locale fallback for localized views
2013-03-18 09:14:15 -07:00
Yves Senn
85261a5e96 remove ancient TODOs [ci skip]. 2013-03-18 16:42:08 +01:00
Rafael Mendonça França
b365354e59 Merge pull request #9754 from macksmind/fix_actionpack_warnings
Fix rake test warnings in actionpack
2013-03-17 09:18:09 -07:00
Mack Earnhardt
c23f3aa7c0 Fix rake test warnings in actionpack 2013-03-17 12:16:42 -04:00
Grzegorz Derebecki
3ab7ddb8da Allow pass multipart option to form_for 2013-03-17 10:51:08 +01:00
Juan Barreneche
cecbf5dd4d Include I18n fallbacks in :locale lookup context 2013-03-16 21:27:13 -03:00
Aaron Patterson
e115ace02a fix protocol checking in sanitization [CVE-2013-1857] 2013-03-15 17:46:34 -07:00
Charlie Somerville
8be6913990 fix incorrect ^$ usage leading to XSS in sanitize_css [CVE-2013-1855] 2013-03-15 17:45:53 -07:00
Steve Klabnik
29030d3f89 Merge pull request #5606 from teohm/multipart_unicode_param_name
multipart POST - utf8 param name not encoded
2013-03-15 10:25:15 -07:00
Yves Senn
41a14dcd10 Http::Headers directly modifies the passed environment.
The env hash passed to `Http::Headers#new` must be in env format.
Also be aware that the passed hash is modified directly.

docs and test-cases for setting headers/env in functional tests.

Follow up to #9700.
2013-03-15 10:13:49 +01:00
Teo Hui Ming
b307210d49 UTF-8 encode all keys and values in nested params hash. 2013-03-15 09:17:03 +08:00
Bernard Potocki
2651b597f2 Handle conditional get in live requests - this will prevent error when using stale on live streams(issue #9636) 2013-03-14 09:13:10 +01:00
Yves Senn
a709246d17 Http::Headers respects dotted env vars, symbols, headers with numbers. 2013-03-13 16:41:00 +01:00
Yves Senn
9af59b2468 allow headers and env to be passed in IntegrationTest.
Closes #6513.
2013-03-13 16:41:00 +01:00
Yves Senn
e2a5de2bb2 refactor, Http::Headers stores headers in env notation
Also:
cleanup, use consistent syntax for `Http::Header` and test.
2013-03-13 16:40:47 +01:00
Yves Senn
8945be464f Http::Headers respects headers that are not prefixed with HTTP_ 2013-03-13 16:27:47 +01:00
Sebastian Sogamoso
b3f894c528 Change ActionController::Parameters#require behavior when value is empty
When the value for the required key is empty an ActionController::ParameterMissing is raised which gets caught by ActionController::Base and turned into a 400 Bad Request reply with a message in the body saying the key is missing, which is misleading.

With these changes, ActionController::EmptyParameter will be raised which ActionController::Base will catch and turn into a 400 Bad Request reply with a message in the body saying the key value is empty.
2013-03-11 09:28:22 -05:00
Vipul A M
a0906da6b3 Change from each to each_value on hash to avoid unused variable warning 2013-03-11 00:26:23 +05:30
Olek Janiszewski
8e05a6f638 Fix incorrectly appended square brackets to a multiple select box
If an explicit name has been given and it already ends with "[]"

Before:

    select(:category, [], {}, multiple: true, name: "post[category][]")
    # => <select name="post[category][][]" ...>

After:

    select(:category, [], {}, multiple: true, name: "post[category][]")
    # => <select name="post[category][]" ...>
2013-03-08 19:01:32 +01:00
Carlos Antonio da Silva
b67043393b Fix warnings 2013-03-07 21:32:51 -03:00
Rafael Mendonça França
de4a60c9f4 Merge pull request #9464 from jcoyne/assert_template_file
Allow use of assert_template with the :file option.
2013-03-07 14:00:39 -08:00