aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Revert "Merge branch 'master-sec'"Jeremy Kemper2013-01-081-22/+6
| | | | | | | | | | | | | | | This reverts commit 88cc1688d0cb828c17706b41a8bd27870f2a2beb, reversing changes made to f049016cd348627bf8db0d72382d7580bf802a79.
* | | CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml.Jeremy Kemper2013-01-081-6/+22
|/ /
* | Namespace HashWithIndifferentAccessAkira Matsuda2013-01-071-1/+1
| |
* | Remove unnecessary begin..rescue..end, use only rescueAkira Matsuda2013-01-062-14/+10
| |
* | deprecate `assert_blank` and `assert_present`.Yves Senn2013-01-053-20/+29
| | | | | | | | | | They don't add any benefits over `assert object.blank?` and `assert object.present?`
* | Better error message for String#to_dateKelly Stannard2013-01-041-0/+1
| | | | | | | | | | | | | | | | | | | | I did this because to_date gives a very unhelpful error message if you do not pass in a correct date. In the process I think this cleans up the code nicely and even better it tends to be slightly faster than the current implementation. Benchmark https://gist.github.com/4440875
* | Remove assert_nothing_raisedRafael Mendonça França2013-01-036-67/+49
| |
* | Added ability to compare date/time with infinitybUg2013-01-046-0/+126
|/ | | | | | | | | | | | | | | | | Date, DateTime, Time and TimeWithZone can now be compared to infinity, so it's now possible to create ranges with one infinite bound and date/time object as another bound. Ex.: @range = Range.new(Date.today, Float::INFINITY) Also it's possible to check inclusion of date/time in range with conversion. Ex.: @range.include?(Time.now + 1.year) # => true @range.include?(DateTime.now + 1.year) # => true Ability to create date/time ranges with infinite bound is required for handling postgresql range types.
* Only call MiniTest.autorun if the dependecy is presentRafael Mendonça França2012-12-314-16/+12
|
* Alias refute methods to assert_not and perfer assert_not on testsRafael Mendonça França2012-12-312-3/+3
|
* Remove unneeded testsRafael Mendonça França2012-12-311-22/+0
| | | | These tests are needed only if we are using MiniTest::Spec
* Add active_support/testing/autorunRafael Mendonça França2012-12-312-2/+2
| | | | | minitest/autorun load minitest/spec polluting the global namespace with the DSL that we don't want on Rails
* Test that assert_not returns true. Use assert_raises instead of doing ↵Jeremy Kemper2012-12-281-17/+7
| | | | begin/rescue/else.
* Introduce assert_not to replace 'assert !foo'Jeremy Kemper2012-12-281-0/+21
|
* rewrite order dependent test case. #8185Yves Senn2012-12-271-1/+2
| | | | | | As reported (https://github.com/rails/rails/pull/8185#issuecomment-11702226) this test relied on the order a hash was serialized. Comparing the parsed hash makes the test no longer order dependent.
* Make test logs easier to read.Jeremy Kemper2012-12-261-2/+1
| | | | | | Tagging every message in tests makes the logs really wide. It's great for grepping, but annoying to open in an editor or a narrow terminal. Try out a different approach: spit out a heading before each test.
* deprecation warning when BufferedLogger is instantiatedYves Senn2012-12-251-0/+8
|
* ActiveSupport::BufferedLogger can be subclassedYves Senn2012-12-251-0/+14
|
* minor grammar fixZoltan Kiss2012-12-241-1/+1
|
* silences "possibly useless use of :: in void context" warningsXavier Noria2012-12-241-7/+3
| | | | | | | | | | | | | The AS utility silence_warnings does not really silence this one, because it is issued at parse-time. It seemed to in some places because the constant was the only expression in the block and therefore it was its return value, that could potentially be used by silence_warnings are return value of the yield call. To bypass the warning we assign to a variable. The chosen variable is "_" because it is special-cased in parse.c not to issue an "assigned but unused variable" warning in turn.
* Move background jobs to the 'jobs' branch until fully baked. Not shipping ↵Jeremy Kemper2012-12-213-283/+0
| | | | with Rails 4.0.
* Merge pull request #8471 from kytrinyx/refactor-xml-to-hashSteve Klabnik2012-12-211-1/+1
|\ | | | | WIP Refactor xml conversion to hash
| * Refactor Hash.from_xml.Steve Klabnik + Katrina Owen2012-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Three basic refactors in this PR: * We extracted the logic into a method object. We now don't define a tone of extraneous methods on Hash, even if they were private. * Extracted blocks of the case statement into methods that do the work. This makes the logic more clear. * Extracted complicated if clauses into their own query methods. They often have two or three terms, this makes it much easier to see what they _do_. We took care not to refactor too much as to not break anything, and put comments where we suspect tests are missing. We think ActiveSupport::XMLMini might be a good candidate to move to a plugin in the future.
* | Merge pull request #7376 from ↵Rafael Mendonça França2012-12-212-10/+62
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | dmitriy-kiriyenko/fix-double-callback-in-same-statement Prevent callback from being set twice. Conflicts: activesupport/CHANGELOG.md
| * | Prevent callback from being set twice.Dmitriy Kiriyenko2012-12-202-10/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you add one callack in two separate `set_callback` calls - it is only called once. When you do it in one `set_callback` call - it is called twice. This violates the principle of least astonishment for me. Duplicating callback is usually an error. There is a correct and obvious way to do anything without this "feature". If you want to do before_save :clear_balance, :calculate_tax, :clear_balance or whatever, you should better do before_save :carefully_calculate_tax def carefully_calculate_tax clear_balance calculate_tax clear_balance end And this even opens gates for some advanced refactorings, unlike the first approach. My assumptions are: - Principle of least astonishment is violated, when callbacks are either prevented from duplication, or not. - Duplicating callbacks is usually an error. When it is intentional - it's a smell of a bad design and can be approached without abusing this "feature". My suggestion is: do not allow duplicating callbacks in one callback call, like it is not allowed in separate callbacks call.
* | | Add ActiveSupport::Logger#silence that works the same as the old ↵David Heinemeier Hansson2012-12-211-0/+10
| | | | | | | | | | | | Logger#silence extension
* | | AS::BasicObject can be inherited fromPavel Pravosud2012-12-151-0/+12
| | |
* | | Remove unicode character encoding from ActiveSupport::JSON.encodeBrett Carter2012-12-141-3/+16
|/ / | | | | | | | | | | | | | | | | | | The encoding scheme (e.g. ☠ -> "\u2620") was broken for characters not in the Basic Multilingual Plane. It is possible to escape them for json using the weird encoding scheme of a twelve-character sequence representing the UTF-16 surrogate pair (e.g. '𠜎' -> "\u270e\u263a") but this wasn't properly handled in the escaping code. Since raw UTF-8 is allowed in json, it was decided to simply pass through the raw bytes rather than attempt to escape them.
* | Backport thread-local variables from Ruby 2.0Rafael Mendonça França2012-12-111-0/+77
| |
* | Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-114-29/+41
| | | | | | | | | | | | | | The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time methods were added to handle the limitations of Ruby's native Time implementation. Those limitations no longer apply so we are deprecating them in 4.0 and they will be removed in 4.1.
* | Beef up tests for String#in_time_zone and Date#in_time_zoneAndrew White2012-12-112-18/+128
| |
* | Deprecate Date#to_time_in_current_zoneAndrew White2012-12-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The to_time_in_current_zone method doesn't match the naming of the methods for converting to ActiveSupport::TimeWithZone on Time and DateTime. Since DateTime inherits from Date that has led to confusion with some users using the to_time_in_current_zone method with DateTime instances and having the time part dropped and the UTC offset lost. This commit fixes this by deprecating the old method and adding a new in_time_zone method which matches the naming for DateTime and Time. This should prevent accidently dropping times and UTC offsets when converting DateTime instances to ActiveSupport::TimeWithZone.
* | Add String#in_time_zone methodAndrew White2012-12-111-24/+44
|/ | | | | | This commit adds a convenience method for converting a string to an ActiveSupport::TimeWithZone instance using the configured Time.zone or another passed as an argument.
* Rename ActiveSupport::BasicObject to ActiveSupport::ProxyObjectFrancesco Rodriguez2012-12-071-2/+2
| | | | | AS::BasicObject is used for proxy classes. Let's give it a less concerning name. Also, it avoids the confusion with Ruby's Basic Object.
* silence warning: possibly useless use of a constant in void contextkennyj2012-12-061-3/+7
|
* Merge pull request #8393 from frodsan/fix_dependend_order_test_exampleCarlos Antonio da Silva2012-12-031-0/+3
|\ | | | | Ensure original encoding does not change in mb_chars test.
| * ensure original encoding doesnt changeFrancesco Rodriguez2012-12-011-0/+3
| |
* | Only take the date parts from Time.zone.nowAndrew White2012-12-011-0/+7
|/ | | | | | | When there are missing components in the Hash returned by Date._parse only the date components should default to the value of Time.zone.now, the time components should all default to zero.
* Patched Marshal#load to work with constant autoloading ↵Uriel Katz2012-12-014-19/+195
| | | | (active_support/dependecies.rb) (issue #8167)
* Make `Time.zone.parse` to work with JavaScript date stringsAndrew White2012-12-011-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrome, Safari and Firefox serialize Date objects to strings such as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings are parsed the zone is interpreted as 'GMT-0700' which doesn't exist in the TzInfo list of timezones. By taking advantage of the improved date/time handling in 1.9.3 we can use `Date._parse` and the `:offset` value which is parsed correctly. Three tests were amended to make them pass: 1. test_parse_with_old_date This needed changing to a different value because the original value was before EST was adopted so was being changed to a LMT (Local Mean Time) value after the change. It didn't before because `DateTime` just has offsets from UTC not timezones. 2. test_parse_should_not_black_out_system_timezone_dst_jump Changed the implementation of this test as the stubs were dependent on internal implementation details of the test. Confirmed that the modified test still failed when the implementation of `parse` was restored to pre-#5571. 3. test_parse_should_black_out_app_timezone_dst_jump Ditto. Closes #5770.
* Add #seconds_until_end_of_day to DateTime and TimeOlek Janiszewski2012-11-292-0/+56
|
* Simplify String#mb_chars and stop proxying #classSteve Klabnik2012-11-281-1/+4
| | | | | | | | This behavior mattered under Ruby 1.8, but that doesn't matter now that we don't support it. In addition, we don't want to proxy the #class method. A test was added to prevent against regressions.
* prevent Dependencies#remove_const from autoloading parents [fixes #8301]Xavier Noria2012-11-281-0/+10
|
* Properly deprecate #pending from AS::TestCaseCarlos Antonio da Silva2012-11-181-0/+6
| | | | Check https://github.com/rails/rails/pull/4575#issuecomment-5765575.
* Use Integer#div instead of Integer#/ to avoid side effects from mathnMarc-Andre Lafortune2012-11-161-0/+8
|
* Merge pull request #8112 from rails/encrypted_cookiesSantiago Pastorino2012-11-151-1/+1
|\ | | | | Encrypted cookies
| * Add cookie.encrypted which returns an EncryptedCookieJarSantiago Pastorino2012-11-031-1/+1
| | | | | | | | | | | | | | | | | | How to use it? cookies.encrypted[:discount] = 45 => Set-Cookie: discount=ZS9ZZ1R4cG1pcUJ1bm80anhQang3dz09LS1mbDZDSU5scGdOT3ltQ2dTdlhSdWpRPT0%3D--ab54663c9f4e3bc340c790d6d2b71e92f5b60315; path=/ cookies.encrypted[:discount] => 45
* | Merge pull request #8219 from nikitug/threadsafe_xmlmini_with_backendRafael Mendonça França2012-11-151-0/+62
|\ \ | | | | | | | | | | | | | | | | | | Make XmlMini.with_backend usable with threads Conflicts: activesupport/CHANGELOG.md
| * | Make XmlMini.with_backend usable with threadsNikita Afanasenko2012-11-151-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `XmlMini.with_backend` now may be safely used with threads: Thread.new do XmlMini.with_backend("REXML") { rexml_power } end Thread.new do XmlMini.with_backend("LibXML") { libxml_power } end Each thread will use it's own backend.
* | | let remove_constant still delete Kernel#autoload constants [rounds #8213]Xavier Noria2012-11-151-2/+2
|/ / | | | | | | | | The method #remove_const does not load the file, so we can still remove the constant.