aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/date_helper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix RuboCop offensesKoichi ITO2017-08-161-26/+26
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActionView frozen string literal friendly.Pat Allan2017-06-201-187/+187
|/ | | | Plus a couple of related ActionPack patches.
* Remove requirement on mathnRobin Dupret2017-05-301-3/+11
| | | | | | | | | | | | | The test using mathn was first introduced in f1d9179 to check that the `distance_of_time_in_words` properly doesn't use the `Fixnum#/` method by explicitly requiring this library as it redefines this method. Given that `mathn` has been gemified in Ruby 2.5 and is deprecated since version 2.2, we can certainly safely assume that people will most-likely not require this library in their application. However, to make sure that we don't regress, let's add a test similar to the one before f1d9179.
* Ensure input to distance_of_time_in_words is not nilJay Hayes2017-04-271-0/+10
| | | | | | | | | | | | | | | | * Internally all input is converted to time so that it can be treated uniformly. Remove now-unneeded condition * Now that all input is treated is converted to time, we no longer need to type check it. Rename variables to clarify their purpose Extract private method to normalize distance_of_time args to time Update actionview changelog
* Deprecate implicit coercion of `ActiveSupport::Duration`Andrew White2017-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `ActiveSupport::Duration` implicitly converts to a seconds value when used in a calculation except for the explicit examples of addition and subtraction where the duration is the receiver, e.g: >> 2 * 1.day => 172800 This results in lots of confusion especially when using durations with dates because adding/subtracting a value from a date treats integers as a day and not a second, e.g: >> Date.today => Wed, 01 Mar 2017 >> Date.today + 2 * 1.day => Mon, 10 Apr 2490 To fix this we're implementing `coerce` so that we can provide a deprecation warning with the intent of removing the implicit coercion in Rails 5.2, e.g: >> 2 * 1.day DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration to a Numeric is deprecated and will raise a TypeError in Rails 5.2. => 172800 In Rails 5.2 it will raise `TypeError`, e.g: >> 2 * 1.day TypeError: ActiveSupport::Duration can't be coerced into Integer This is the same behavior as with other types in Ruby, e.g: >> 2 * "foo" TypeError: String can't be coerced into Integer >> "foo" * 2 => "foofoo" As part of this deprecation add `*` and `/` methods to `AS::Duration` so that calculations that keep the duration as the receiver work correctly whether the final receiver is a `Date` or `Time`, e.g: >> Date.today => Wed, 01 Mar 2017 >> Date.today + 1.day * 2 => Fri, 03 Mar 2017 Fixes #27457.
* Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-121-1/+0
| | | | empty lines
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-46/+46
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-16/+16
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-2/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-3/+3
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-17/+17
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-296/+296
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-76/+76
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Bring Boolean Attributes list for AV Tags helper upto speed with current spec.Vipul A M2016-06-281-4/+0
| | | | | | | | | This is based on https://github.com/kangax/html-minifier/blob/6b2d4536d82819143b468b41a89c700b6c61631f/src/htmlminifier.js#L197 and spec from https://www.w3.org/TR/html51/single-page.html. Couple of other changes to tests due to support update: - autobuffer has been dropped in favour of preload attribute, ref: https://msdn.microsoft.com/en-us/library/ff974743(v=vs.85).aspx - pubdate attribute has been dropped from spec, ref: https://www.w3.org/html/wg/tracker/issues/185
* Make select_year work with include_position: true option, fix #25267Marek2016-06-051-0/+7
|
* date_select helper with_css_classes option also accept a hashneumayr2016-04-051-0/+404
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `date_select` helper `:with_css_classes` option now accepts a hash of strings for `:year`, `:month`, `:day`, `:hour`, `:minute`, `:second` that will extend the select type with the given css class value. ```erb <%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" } %> ``` ```html <select id="user_birthday_3i" name="user[birthday(3i)]">…</select> <select id="user_birthday_2i" name="user[birthday(2i)]" class="my-month">…</select> <select id="user_birthday_1i" name="user[birthday(1i)]" class="my-year">…</select> ``` Optional, add global `html_options` to modify every select tag in the set. ```erb <%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" }, { class: "my-date optional" } %> ``` Supported DateHelper methods: `select_day`, `select_month`, `select_year`, `select_hour`, `select_minute`, `select_second`, `select_datetime`, `select_time`, `time_select`, `date_select` and `datetime_select`. `:with_css_classes` option was added to the `date_select` with #7975.
* html_safe is not supposed to be public API for AV. This change removes usage ↵Vipul A M2016-01-201-1/+1
| | | | | | of html_safe in favour of raw() in AV helpers. Also changed usage of html_safe to make use of raw() instead so that the intended behaviour is verified with raw()
* deletes commented code introduced in db045db (initial commit)Tony Ta2015-12-151-17/+0
|
* deletes commented code introduced in 4673c47dTony Ta2015-12-151-5/+0
|
* making selected value to accept Hash like the default option. E.g. selected: ↵Lecky Lao2015-10-291-0/+20
| | | | | | | | {day: params[:day].to_i, month: params[:month].to_id} Adds in test test_date_select_with_selected_in_hash and change log fixes typo in CHANGELOG
* :put_litter_in_its_place: Unused methodsAkira Matsuda2015-04-251-8/+0
|
* Silence warning from requiring mathnPrem Sichanugrist2015-04-221-1/+1
| | | | | | | | | Running Action View test case currently printing out this warning: lib/mathn.rb is deprecated This should silence the warning since we really want to require this file in this test.
* Use directly TZInfo::Timezone without proxybrainopia2015-01-041-1/+1
| | | | | Since real timezone is loaded anyway in `#utc_offset` which is called during `#create`
* Duplicated Hash key :promptAkira Matsuda2014-11-191-1/+1
|
* All these tests are passing nowRafael Mendonça França2014-07-151-4/+0
|
* Change date helper tests to expect attributes with double quoted strings.Timm2014-06-161-14/+15
|
* Added related Nokogiri issue link to tests that fail with unknown encoding ↵Timm2014-06-161-4/+4
| | | | ASCII-8BIT.
* Marked some tests as pending in date_helper_test.rb.Timm2014-06-151-0/+4
|
* Fix date_select option overwriting html classesIzumi Wong-Horiuchi2014-03-241-0/+16
| | | | | with_css_classes: true option overwrites other html classes. Concatenate day month and year classes rather than overwriting.
* implements new option :month_format_string for date select helpers [Closes ↵Xavier Noria2014-02-151-0/+10
| | | | #13618]
* Remove privatizing of Fixnum#/ from assert_distance_of_time_in_wordsAlex Tambellini2013-08-051-5/+7
| | | | | | | | MRI reimplemented Date in C so it doesn't hit this division anymore while JRuby still uses the old stdlib implementation of Date so it will always hit this. With this change the actionview date_helper_test.rb tests should pass on JRuby.
* Move template tests from actionpack to actionviewPiotr Sarnacki2013-06-201-0/+3199