1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

17 commits

Author SHA1 Message Date
Akira Matsuda
0157608508 DRY fake models for testing 2017-02-02 16:43:29 +09:00
Akira Matsuda
9360b6be63 class Foo < Struct.new(:x) creates an extra unneeded anonymous class
because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
2017-01-13 15:13:47 +09:00
Rafael Mendonça França
530e5ff910
Generate indexed names in input even when objects are not persisted
When you ask to generate multiple nested inputs using:

    field_for('comments[]', Comment.new) do |c|
      c.text_field :body

Rails should generated the names like `post[comments][][body]`.

To make sure we don't have regression the fake models now use the same
implementation of `#to_param` as `ActiveRecord::Base`

Fixes #26942
2017-01-03 16:47:13 -05:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
4b6c68dfb8 applies new string literal convention in actionview/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:50:17 +02:00
Rafael Mendonça França
ddf4c953ae Revert "Merge pull request #22764 from stevenspiel/titleize_model_name_for_default_submit_button_value"
This reverts commit 4158974c60, reversing
changes made to 3d590add45.

Reason: This break i18n in some languages. See
https://github.com/rails/rails/issues/791#issuecomment-192724640
2016-03-05 17:26:04 -03:00
yui-knk
54aaf85e4f Suppress warning (instance variable @persisted not initialized) 2016-01-07 10:24:54 +09:00
Steven Spiel
c74f9cc0e8 downcase default submit button value's model name 2016-01-01 19:59:11 -05:00
Rafael Mendonça França
0caac9bf9b Add tests to make sure label and placeholder respect to_model 2015-02-05 16:19:29 -02:00
claudiob
b26338e83b Better tests for AV::RecordIdentifier
This commit intends to clarify the scope of ActionView::RecordIdentifier
methods `dom_id` and `dom_class`.

Most of the current documentation comes from da257eb8 (7 years ago) when
the decoupling of ActionView, ActiveRecord and ActiveModel was not a concern.

Since then, steps have been taken to reach such decoupling.
Therefore I think it's important to show that ActionView::RecordIdentifier
**does not strictly depend on the ActiveRecord API**:
any class `Post` implementing `post.to_key` and `post.model_name.param_key`
will work.

This commit adds a test to prove that ActionView::RecordIdentifier methods
can also be used on objects that do not subclass ActiveRecord::Base.
2014-12-23 01:59:25 +01:00
claudiob
7375c17114 Remove unused Sheep fixture from AV
The `Sheep` fixture was added in eb23754e when moving template tests
from actionpack to actionview, but it's not actually used in ActionView tests.

The `Sheep` fixture is only used to test `uncountable` in ActiveModel tests,
and is already defined in activemodel/test/models/sheep.rb
2014-12-22 04:02:35 +01:00
Arun Agrawal
64eb39a5b9 Moved viewpathstest into actionview/test/actionpack/controller
These test were not running at all,
Now it will run as a tests part.
2013-10-09 20:09:33 +02:00
Arun Agrawal
32b42e2620 FakeController is not required in AV 2013-10-09 19:30:44 +02:00
Łukasz Strzałkowski
1b446d06dd Move view_paths from AP to AV 2013-08-25 11:39:07 +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