Commit Graph

1825 Commits

Author SHA1 Message Date
José Valim
7da88c5b29 Remove stream at the class level.
This is because only template rendering works with streaming.
Setting it at the class level was also changing the behavior
of JSON and XML responses, closes #1337.
2011-07-06 20:24:30 -03:00
Damien Mathieu
ac15bcebf2 provide a more explicit message when using url_for with nil
This fixes the problem of having a non-explicit message when the :location option is not provided in respond_with.
2011-07-02 18:53:54 +02:00
José Valim
9c9ec2172e Make sure respond_with with :js tries to render a template in all cases 2011-06-30 11:47:36 -03:00
Esad Hajdarevic
2a61d47b55 Make send_file guess content-type from file extension, if type wasn't supplied (Issue #1847). Update tests & documentation. 2011-06-28 06:58:28 +02:00
David Chelimsky
a7af1e0051 Get the fixture_path from self.class instead of ActiveSupport::TestCase.
This allows test classes that are not subclasses of
ActiveSupport::TestCase (like those in rspec-rails) to interact with
with this variable without having to reference ActiveSupport::TestCase.
2011-06-25 13:59:49 -05:00
Jeroen Jacobs
93ff522120 Tests only after filters in cache sweepers 2011-06-22 18:00:46 +02:00
Neeraj Singh
f3c9f32664 remove meaningless assert true 2011-06-11 03:11:06 -04:00
Neeraj Singh
6688b6393a expected message should come first 2011-06-11 03:11:06 -04:00
Neeraj Singh
5da89af6f6 try not to use assert_blank when nil will would
be considered as failure

Test for specific value to the extent possible
2011-06-11 03:11:05 -04:00
Neeraj Singh
06d772c0ce add missing ensure 2011-06-10 02:48:44 -04:00
Neeraj Singh
fdbe8eb08c replaced and with && as per coding guidelines 2011-06-10 02:27:57 -04:00
Neeraj Singh
49d032929b The test name is misleading. It says
test_should_cache_with_trailing_slash_on_url

A trailing slash is removed when a page is cached.

What the test meant to say was : a url with trailing slash
should be cached and the cached page should not have any
trailing slash.

This patch clarifies the name a bit.
2011-06-10 02:24:37 -04:00
Neeraj Singh
fa5b34ed22 remove unused user_controller from test 2011-06-08 22:49:38 -04:00
Andrew White
d4658d86fe Refactor ActionController::TestCase cookies
Assigning cookies for test cases should now use cookies[], e.g:

  cookies[:email] = 'user@example.com'
  get :index
  assert_equal 'user@example.com', cookies[:email]

To clear the cookies, use clear, e.g:

  cookies.clear
  get :index
  assert_nil cookies[:email]

We now no longer write out HTTP_COOKIE and the cookie jar is
persistent between requests so if you need to manipulate the environment
for your test you need to do it before the cookie jar is created.
2011-06-04 07:09:11 +01:00
Damien Mathieu
8a0ffa7c95 fix creating an empty route on 1.8. Closes #1210 2011-06-01 15:51:36 +02:00
Lee Reilly
4f234bfd79 Corrected some typos and American vs. Queen's English issues 2011-05-29 12:40:24 -07:00
José Valim
a46b03e728 Merge pull request #1203 from dchelimsky/stringify-parameter-values-in-tests
Stringify param values in controller tests.
2011-05-28 12:43:13 -07:00
dmathieu
16571f9c42 don't raise an exception if the format isn't recognized
Fixed while traveling to heuruko
2011-05-26 11:18:30 +02:00
Josh Kalderimis
d182b6ee9c removed deprecated methods, and related tests, from ActionPack 2011-05-24 23:38:59 +02:00
Jon Leighton
d411c85a65 Replace references to ActiveSupport::SecureRandom with just SecureRandom, and require 'securerandom' from the stdlib when active support is required. 2011-05-23 20:25:44 +01:00
wycats
7b9f3eb10b Always initialize @title in caching test to avoid uninitialized instance variable warning 2011-05-22 23:14:52 -07:00
David Chelimsky
9277e72a3c Stringify param values in controller tests.
This reduces false positives that come from using ints in params in
tests, which do not get converted to strings in the tests. In
implementations going through rack, they do get converted to strings.

- David Chelimsky and Sam Umbach
2011-05-22 02:47:54 -04:00
Josh Kalderimis
968596fa7f renamed the wrap_parameters :only and :except options to :include and :exclude to make it consistent with controller filters 2011-05-19 10:33:25 -04:00
David Chelimsky
13950a8cc9 add more robust test for wrapping params with anonymous class 2011-05-17 06:57:14 -04:00
David Chelimsky
14d5e3e459 better test name 2011-05-17 06:56:53 -04:00
David Chelimsky
29e8ca3698 add failing test for https://github.com/rails/rails/issues/1089 2011-05-17 06:56:46 -04:00
Prem Sichanugrist
d77b306b63 Make ParamsWrapper calling newly introduced Model.attribute_names instead of .column_names 2011-05-15 19:07:44 -04:00
Prem Sichanugrist
3bed43c6a5 Do not try to call column_names on the abstract class.
Normally the table for abstract class won't be existed, so we should not trying to call `#column_names` on it.
2011-05-15 00:41:20 -04:00
David Lee
8366cabd65 Test csrf token param name customization 2011-05-10 18:24:14 -07:00
José Valim
a87894ae57 Get around weird missing constant error caused by AS instead of simply raising NameError, closes #477. 2011-05-11 00:08:43 +02:00
José Valim
9c2c25c1a1 Revert to old semantics, use available_action? instead of action_method?. 2011-05-06 18:44:18 +02:00
Nick Sutterer
65ceccb0ba controller's prefixes are now added to LookupContext. 2011-05-03 23:41:38 +02:00
Vijay Dev
f490a81443 Fix typos in test method names 2011-05-03 23:35:01 +05:30
Josh Kalderimis
275529446e raise an error if the old router draw method is used, along with a message advising them to either upgrade their routes or add rails_legacy_mapper to their Gemfile 2011-05-03 16:07:25 +02:00
Prem Sichanugrist
31f412fc97 Fix broken params_wrapper_test on 1.8.7 💣
I have to keep in mind that 1.8.7 does *not* preserve the hash order.

Guys, let's move to use 1.9.2 in production!
2011-05-03 16:51:19 +07:00
José Valim
a55f2de0c5 Improve performance for filtered parameters and add tests. 2011-05-03 01:04:57 +02:00
José Valim
4bddc06e83 Move most processing to load time for performance and improve test suite. 2011-05-03 01:04:57 +02:00
Prem Sichanugrist
8c9e4d5202 Add ActionController::ParamsWrapper to wrap parameters into a nested hash
This will allow us to do a rootless JSON/XML request to server.
2011-05-03 03:21:43 +07:00
José Valim
13df194c00 Tidy up pending TODOs after discussion with Mr. Gatoz (@wycats). 2011-05-01 19:39:57 +02:00
José Valim
46611a995d log errors when an exception happens when streaming. 2011-05-01 13:40:14 +02:00
José Valim
6960a230fa Add a test for rendering from the controller context. 2011-05-01 13:40:14 +02:00
misfo
9f6cafd5fd prevent errors when passing a frozen string as a param to ActionController::TestCase#process
since ActionDispatch::Http::Parameters#encode_params will force encoding on all params strings (when using an encoding aware Ruby), dup all strings passed into process.  This prevents modification of params passed in and, more importantly, doesn't barf when a frozen string is passed
thanks and high fives to kinsteronline
2011-04-28 04:07:57 +08:00
David Chelimsky
8d00dfca7f rename test case to better describe use case
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-25 09:31:48 +02:00
Florent Piteau
89ed9fbd19 Don't reuse a closed flash when using now 2011-04-20 04:32:26 +08:00
José Valim
069e9b004f Do not stream on HTTP/1.0. 2011-04-19 15:04:28 +02:00
José Valim
b398520c14 Output a redirect to the 500 page if something happens when streaming.
Currently, we output:

  "><script type="text/javascript">window.location = "/500.html"</script></html>
2011-04-19 12:26:11 +02:00
José Valim
6380f1a9f4 Be sure to not store the closed flash in the session. 2011-04-19 10:34:17 +02:00
José Valim
3b0f917b1d Test explicit skip. 2011-04-18 14:27:49 +02:00
José Valim
07fde1a3d3 Just define the controller if fibers are defined. 2011-04-18 14:27:49 +02:00
José Valim
389d15ef13 Body... wanna *stream* my body? Body... such a thrill my body!
Added stream as class level method to make it explicit when to stream.
Render also accepts :stream as option.
2011-04-18 08:55:41 +02:00