Commit Graph

77 Commits

Author SHA1 Message Date
Ryuta Kamizono
245c1dafa8 Enable Layout/LeadingCommentSpace to not allow cosmetic changes in the future
Follow up of #31432.
2017-12-14 17:30:54 +09:00
Matthew Draper
7d264ba8cd Merge pull request #31005 from shuheiktgw/remove_unnecessary_semicolons
Removed unnecessary semicolons
2017-10-28 22:55:34 +10:30
Koichi ITO
7c260ae201 Fix RuboCop offenses
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
2017-08-16 17:55:25 +09:00
Kir Shatrov
424117281e Use frozen string literal in actionview/ 2017-07-24 11:53:43 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
bogdanvlviv
40bdbce191
Define path with __dir__
".. with __dir__ we can restore order in the Universe." - by @fxn

Related to 5b8738c2df003a96f0e490c43559747618d10f5f
2017-05-23 00:53:51 +03:00
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
yuuji.yaginuma
75607a67b4 use Gem.win_platform? to check windows Ruby platforms
`Gem.win_platform?` check if it is Windows more accurately.
Ref: https://github.com/ruby/ruby/blob/ruby_2_2/lib/rubygems.rb#L945..L952
2016-11-30 20:57:50 +09:00
Ryuta Kamizono
d99b3848bb Fix require_dependency message format
`depend_on` message format is `"No such file to load -- %s.rb"`.
But `require_dependency` message is missing `.rb` suffix.

```
% git grep -n 'No such file to load'
actionview/test/actionpack/abstract/helper_test.rb:112:        assert_equal "No such file to load -- very_invalid_file_name.rb", e.message
activesupport/lib/active_support/dependencies.rb:245:      def require_dependency(file_name, message = "No such file to load -- %s.rb")
activesupport/lib/active_support/dependencies.rb:333:    def depend_on(file_name, message = "No such file to load -- %s.rb")
```
2016-11-25 06:56:05 +09:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
56832e791f let Regexp#match? be globally available
Regexp#match? should be considered to be part of the Ruby core library. We are
emulating it for < 2.4, but not having to require the extension is part of the
illusion of the emulation.
2016-10-27 09:13:55 +02:00
Ryuta Kamizono
3464cd5c28 Fix broken comments indentation caused by rubocop auto-correct [ci skip]
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
2016-09-14 18:26:32 +09:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Ryuta Kamizono
7924be5a79 Fix actionview test failure
Caused by #26092.
2016-08-11 14:04:45 +09:00
Ryuta Kamizono
f006de5dc5 Fix broken alignments caused by auto-correct commit 411ccbd
Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
2016-08-10 06:36:39 +09:00
Xavier Noria
a9dc45459a code gardening: removes redundant selfs
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.

Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
2016-08-08 01:12:38 +02:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
63fff600ac modernizes hash syntax in actionview 2016-08-06 19:36:34 +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
Xavier Noria
7ebef567ce systematic revision of =~ usage in AV
Where appropriate, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
2016-07-25 00:31:35 +02:00
Sean Griffin
e6bb1a1b1f Delete bad test
This test was broken by f650e0324207e46ed5240380e60bdf1e2a5023a6. It was
added by https://github.com/rails/rails/pull/17978, and is adequately
tested elsewhere. The reason that this breaks is that
`Controller#process` is not going to set a new response object, and we
now terminate in callbacks if the response has been sent. The only
reason that this test was calling `get` in the first place was because
the controller under test blows up if `request` was `nil`. The point
being that the failure is invalid, and I don't think we need to fix the
test in this location.
2016-06-07 14:36:14 -04:00
Rafael Mendonça França
ce5538be68
Add more test coverage to layouts
[Rafael Mendonça França + Nick Sutterer + thedarkone]
2016-05-20 22:41:32 -03:00
Aaron Patterson
d6bac04692
keep layouts + locals from bloating the cache
Using locals will cause layouts to be cached multiple times in the
template cache.  This commit removes locals from consideration when
looking up the layout.
2016-05-17 11:28:51 -07:00
Aaron Patterson
07fe3569e6
locals can be accessed from templates rendered in the controller 2016-05-17 09:50:51 -07:00
yui-knk
1099329be0 Delete needless require 'active_support/deprecation'
When `require 'active_support/rails'`, 'active_support/deprecation'
is automatically loaded.
2015-10-20 20:02:59 +09:00
Jeremy Daer
565094a8b5 Use Mime[:foo] instead of Mime::Type[:FOO] for back compat
Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
that support multiple Rails versions would've had to feature-detect
whether to use `Mime::Type[:FOO]` or `Mime::FOO`.

`Mime[:foo]` has been around for ages to look up registered MIME types
by symbol / extension, though, so libraries and plugins can safely
switch to that without breaking backward- or forward-compatibility.

Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
by type or extension, so it's not available as `Mime[:all]`. We use it
internally as a wildcard for `respond_to` negotiation. If you use this
internal constant, continue to reference it with `Mime::ALL`.

Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
2015-10-06 11:29:30 -07:00
Aaron Patterson
4ddbd437c6 render should return a string 2015-10-05 17:33:59 -07:00
Akira Matsuda
64766e82d6 🔪 Typos 2015-09-21 03:17:39 +09:00
Prem Sichanugrist
8cb8ce98d9 Stop using deprecated render :text in test
This will silence deprecation warnings.

Most of the test can be changed from `render :text` to render `:plain`
or `render :body` right away. However, there are some tests that needed
to be fixed by hand as they actually assert the default Content-Type
returned from `render :body`.
2015-07-17 22:27:33 -04:00
Prem Sichanugrist
e26d11c876 Change AC::TestResponse to AD::TestResponse
ActionController::TestResponse was removed in d9fe10c and caused a test
failure on Action View as its test case still refers to it.
2015-07-14 09:27:42 -04:00
Aaron Patterson
2838a1f4ac use new constructor. (Oops! 💣) 2015-07-08 16:38:01 -07:00
Matthew Draper
def14505b7 Revert "revises a test to account for case-insensitive file systems"
This reverts commit d345ce9630ce4c01bc81a09fb015e7bd935600ad.
2015-06-14 02:46:40 +09:30
Rafael Mendonça França
8193a09a1f Revert "Merge pull request #19685 from vngrs/actionview_parent_layout_bug"
This reverts commit a9d58c77da800bb0052c9bfa432828b02526022c, reversing
changes made to 041c2c879a3c4086ad3aa6d30fed1eede1d53c11.

Reason: The old behavior is how it was working in previous version of
Rails since 4.0.x so it is not safe to backport to a stable branch.

See https://github.com/rails/rails/issues/19626#issuecomment-89862258
and https://github.com/rails/rails/pull/15050#issuecomment-45333449
2015-06-02 20:57:54 -03:00
Guo Xiang Tan
ca83436d1b Remove assigns and assert_template. 2015-05-30 14:13:57 +08:00
Mehmet Emin İNAÇ
44781b6e97 Deprecate :nothing option for render method
`head` method works similar to `render` method with `:nothing` option
2015-05-28 15:13:32 +03:00
Guo Xiang Tan
3d4004ab63 Remove deprecation warning.
https://travis-ci.org/rails/rails/jobs/63594316#L1982
2015-05-22 19:16:47 +08:00
Xavier Noria
d345ce9630 revises a test to account for case-insensitive file systems
The patched test assumed the file system is case-sensitive, but that is not
necessarily the case. In particular, this test did not pass in the recommended
setup for the dev box, because the /vagrant shared folder is case-insensitive.

After looking at some gems that provide access to file system metadata I have
chosen to go with the check you can see in the patch because, albeit it's a bit
dirty creating a file, it is super easy to understand and clearly portable.

References https://github.com/rails/rails-dev-box/issues/102.
2015-05-21 21:45:51 +02:00
Mehmet Emin İNAÇ
c51aa9f6f2 fix for actionview parent layout bug
This commit fixes issue #19626
Don't need to check layout conditions if there is no condition

test for parent layout bug fix
2015-04-08 11:39:29 +03:00
Thiago Pradi
cc67dd9644 Cleaning unused views from actionpack tests inside actionview 2015-03-14 16:32:03 -03:00
Rafael Mendonça França
68a2a67116 Merge pull request #18948 from kaspth/automatic-collection-caching
Merge multi_fetch_fragments.
2015-02-25 11:54:07 -03:00
Franky W
b1d2635057 Error message testing fix
The testing of error messages have been implemented wrongly a few times.
This is an attempt to fix it.

For example, some of these test should have failed with the new code.
The reason they are not failling with the new string is the fact they
were not being tested beforehand.
2015-02-20 21:23:36 -02:00
Kasper Timm Hansen
e56c635427 Merge multi_fetch_fragments.
Makes caching a collection of template partials faster using `read_multi`
on the Rails cache store.

Some caching implementations have optimized `read_multi` so we don't have
to check in the cache store for every template.
2015-02-20 20:07:50 +01:00
yuuji.yaginuma
37b36a48b9 use kwargs instead of xhr method. refs #18771. 2015-02-07 09:12:20 +09:00
Vipul A M
dd6b0c2a3d Fixed test for deprecation warning in actionview, renaming from baf14ae513 2015-01-31 21:54:33 +05:30
brainopia
685142e4f4 Support :assigns option when rendering with controllers/mailers. 2015-01-22 00:25:50 +03:00
Kuldeep Aggarwal
90aef23e38 No need of requiring rbconfig, it is by-default loaded 2015-01-10 20:27:18 +05:30