Commit Graph

37 Commits

Author SHA1 Message Date
Ryuta Kamizono
14ff8e7906 Fix debug helper test 2016-06-03 00:43:42 +09:00
Lachlan Sylvester
a9c6a583b6 Fix calling cache helper with a relation 2015-08-28 17:26:09 +10:00
Guo Xiang Tan
ca83436d1b Remove assigns and assert_template. 2015-05-30 14:13:57 +08:00
Akira Matsuda
2fab16142e 🚮 Unused methods 2015-04-25 17:09:33 +09:00
Aaron Patterson
5eaeb37080 don't need to rescue Exception in this case 2015-03-05 15:19:44 -08:00
Robin Dupret
586fe4471d Avoid accurate assertions on error messages
Since there are disparities between the raised error messages on the
different implementations, let's avoid being too accurate.
2015-03-02 14:05:07 +01:00
Evan Phoenix
e002a68a4e Make the helpers a required argument 2015-02-19 15:11:08 -08:00
robertomiranda
ce8efcf296 Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
2015-01-31 23:12:41 -05:00
Travis Grathwell
3efd90ac5b Fix form_for to work with objects that implement to_model
Previously, if you tried to use form_for with a presenter object
that implements to_model, it would crash in
action_dispatch/routing/polymorphic_routes.rb when asking the presenter
whether it is .persisted?

Now, we always ask .persisted? of the to_model object instead.

This seems to been an issue since 1606fc9d840da869a60213bc889da6fcf1fdc431

Signed-off-by: Eugenia Dellapenna <eugenia.dellapenna@gmail.com>
2014-12-29 18:12:03 -08:00
claudiob
1000e4c51a Move test that depends on ActiveRecord
This commit moves a test from `test/template` to `test/activerecord` since the
test depends on ActiveRecord.

This matches the documentation from [RUNNING_UNIT_TESTS](f28d1ddd50/actionview/RUNNING_UNIT_TESTS.rdoc):

> Test cases in the test/activerecord/ directory depend on having activerecord and sqlite3 installed.
> If Active Record is not in actionview/../activerecord directory, or the sqlite3 rubygem is not installed, these tests are skipped.
> Other tests are runnable from a fresh copy of actionview without any configuration.

---

More details about this commit.

All the tests starting with `require 'active_record_unit'` are already
inside `test/activerecord`, except for the one test this commit moves.

If you don't have `active_record` on your machine, the following command
currently fails on master:

```bash
```
2014-11-21 12:38:28 -08:00
Gert Goet
2d08fd2506 Remove internal options from query string of paths
Fixes #17057
2014-09-25 17:50:16 +02:00
Rafael Mendonça França
5c057f9255 Remove warning 2014-09-01 22:20:39 -03:00
Sammy Larbi
2fae37f0ac Allow polymorphic routes with nil when a route can still be drawn
Suppose you have two resources routed in the following manner:

```ruby
resources :blogs do
  resources :posts
end

resources :posts
```

When using polymorphic resource routing like `url_for([@blog, @post])`, and `@blog` is `nil` Rails should still try to match the route to the top-level posts resource.

Fixes #16754
2014-08-31 11:39:46 -05:00
Rafael Mendonça França
5e6c45a7db Removed warning 2014-08-18 20:41:03 -03:00
Rafael Mendonça França
d2d809868c Merge pull request #15889 from carnesmedia/model-name
Use #model_name on instances instead of classes
2014-08-17 23:01:13 -03:00
José Valim
2b0c602bc3 Remove usafe of respond_to in ActionView tests 2014-08-17 13:20:22 -04:00
Carlos Antonio da Silva
29a6a17a11 Properly assert for the expected messages
The message passed to Minitest's assert_raise is used as output in case
the assertion fails, but we can test against the exact message by using
the actual exception object that is returned from the assert_raise call.
2014-07-30 23:41:19 -03:00
Amiel Martin
6b0e834a19 Use #model_name on instances instead of classes
This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class.

Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
2014-06-24 17:20:24 -07:00
Aaron Patterson
84908bbde9 fix bad merge 2014-05-12 18:08:41 -07:00
Aaron Patterson
b451648e1f add a test for the parameters sent to the url helper for new records 2014-05-12 15:54:44 -07:00
Aaron Patterson
45c8a976af add a test with three objects 2014-05-12 15:54:41 -07:00
Aaron Patterson
38dcb27e72 add a test for passing two models to the polymorphic_url method 2014-05-12 15:54:41 -07:00
Aaron Patterson
ea58684b57 add tests for path based url_for calls 2014-05-08 15:56:15 -07:00
Aaron Patterson
2a10028ee3 don't manipulate the testclass, just add helpers to the instance 2014-05-08 15:07:33 -07:00
Aaron Patterson
66274d6d03 add a test for classes with options 2014-05-08 14:28:09 -07:00
Aaron Patterson
5dd6e1b142 add tests for the polymorphic_path method 2014-05-08 13:43:25 -07:00
Aaron Patterson
de6cda5e5f add more tests around the polymorphic url api 2014-05-08 10:33:57 -07:00
Aaron Patterson
37d4415a7b test for inconsistency between String and Symbol url_for handling 2014-05-07 10:18:18 -07:00
Aaron Patterson
bfcbd6fd4c add tests for symbols passed to polymorphic_url 2014-05-07 09:55:57 -07:00
Aaron Patterson
af864447f1 apparently passing a string to polymorphic_url is something we support
o_O
2014-05-06 18:10:44 -07:00
Aaron Patterson
57e5098032 make sure url_for works similar to polymorphic_url 2014-05-06 17:51:24 -07:00
Aaron Patterson
e60c55d846 add a test for the parameters sent to the url helper for new records 2014-05-06 15:59:58 -07:00
Aaron Patterson
c1c6f514f4 passing a nil in the polymorphic array is not supported. remove nils before you call the method 2014-05-02 14:29:08 -07:00
Aaron Patterson
dece005f0a passing a nil should always raise an ArgumentError 2014-05-02 11:38:37 -07:00
Joost Baaij
89ff1f82f0 Remove wrapping div with inline styles for hidden form fields.
We are dropping HTML 4.01 and XHTML strict compliance since input
tags directly inside a form are valid HTML5, and the absense of
inline styles help in validating for Content Security Policy.
2014-04-14 19:45:12 +02:00
Gaelian Ditchburn
7a085dac2a Switched to use display:none in extra_tags_for_form method.
The use of `display:inline` with the content_tag call in the
extra_tags_for_form method potentially causes display issues with some
browsers, namely Internet Explorer. IE's behaviour of not collapsing
the line height on divs with ostensibly no content means that the
automatically added div containing the hidden authenticity_token, utf8
and _method form input tags may interfere with other visible form
elements in certain circumstances. The use of `display:none` rather
than `display:inline` fixes this problem.

Fixes #6403
2014-01-05 17:16:22 +00:00
Piotr Sarnacki
eb23754ebb Move template tests from actionpack to actionview 2013-06-20 17:23:16 +02:00