aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #19889 from cedrics/long-uri-encoded-keysSean Griffin2015-10-201-0/+5
|\ | | | | FileStore: Long cache keys may result in too long paths due to encoding
| * when checking for too long cache keys used the uri encoded fname Cedric Sohrauer2015-04-241-0/+5
| |
* | Merge pull request #19992 from greysteil/handle-invalid-utf8-in-html-escapeSean Griffin2015-10-201-2/+8
|\ \ | | | | | | | | | Handle invalid UTF-8 strings when HTML escaping
| * | Handle invalid UTF-8 strings when HTML escapingGrey Baker2015-06-081-2/+8
| | | | | | | | | | | | | | | | | | | | | Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8 strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`. Prevents user-entered input passed from a querystring into a form field from causing invalid byte sequence errors.
* | | Update #20737 to address feedbackSean Griffin2015-10-201-0/+8
| | | | | | | | | | | | | | | | | | | | | Given that this pull request affects a mutable value, we need to test for and document the affects on the receiver in this case. Additionally, this pull request was missing a CHANGELOG entry.
* | | Fixed slice! behavior: return nil for out-of-bound parametersGourav Tiwari2015-10-201-0/+4
| | |
* | | Merge pull request #20872 from maxjacobson/more-humane-roundingSean Griffin2015-10-201-0/+2
|\ \ \ | | | | | | | | | | | | Round some numbers more humanely
| * | | Round some numbers more humanelyMax Jacobson2015-07-261-0/+2
| | | | | | | | | | | | | | | | Fix #20869
* | | | Merge pull request #21302 from theunraveler/delegate_reserved_argument_namesSean Griffin2015-10-201-0/+15
|\ \ \ \ | | | | | | | | | | ActiveSupport: Fixing issue when delegating to methods named "block", "args", or "arg"
| * | | | Fixing issue when delegating to methods named "block", "args", or "arg"Jake Bell2015-08-191-0/+15
| | | | |
* | | | | Merge pull request #21883 from tarzan/cache-key-too-preciseSean Griffin2015-10-201-0/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix precision on cache_key
| * | | | | fixes #21815Maarten Jacobs2015-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default timestamp used for AR is `updated_at` in nanoseconds! (:nsec) This causes issues on any machine that runs an OS that supports nanoseconds timestamps, i.e. not-OS X, where the cache_key of the record persisted in the database (milliseconds precision) is out-of-sync with the cache_key in the ruby VM. This commit adds: A test that shows the issue, it can be found in the separate file `cache_key_test.rb`, because - model couldn't be defined inline - transactional testing needed to be turned off to get it to pass the MySQL tests This seemed cleaner than putting it in an existing testcase file. It adds :usec as a dateformat that calculates datetime in microseconds It sets precision of cache_key to :usec instead of :nsec, as no db supports nsec precision on timestamps
* | | | | | Merge pull request #21953 from bdunne/fix_dep_warnMatthew Draper2015-10-172-0/+42
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | Fix deprecation warning messages on deprecate_methods
| * | | | | Fix bug where custom deprecators are not used.Brandon Dunne2015-10-142-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add tests for ActiveSupport::Deprecation.deprecate_methods Modify ActiveSupport::Testing::Deprecation to allow a custom deprecator Leverage ActiveSupport::Testing::Deprecation assert_deprecated Update documentation for ActiveSupport::Deprecation.deprecate_methods Use cases: Using the default deprecator => "removed from Rails X.Y" Passing a custom deprecator in the options hash => "removed from MyGem next-release" Deprecating methods directly from custom deprecator => "removed from MyGem next-release"
* | | | | | Expand support for ActiveSupport::TimeWithZone#utc?David Celis2015-10-151-0/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, ActiveSupport::TimeWithZone#utc? simply runs a check to see if the linked ActiveSupport::TimeZone's name is "UTC". This will only return true for ActiveSupport::TimeZone["UTC"], but not for time zones such as "Etc/UTC", "Etc/Universal", or other time zones that are aliases for UTC. Interestingly enough, ActiveSupport::TimeWithZone#utc? is also aliased as #gmt? but will return false for the "GMT" timezone (along with other TZInfo aliases for GMT). Instead of running a simple check on the TimeZone name, we can rely on the underlying TZInfo::TimezonePeriod and TZInfo::TimezoneOffset which keep a record of of the offset's abbreviated name. The possibilities here for UTC time zones are `:UTC`, `:UCT`, and `:GMT`. Signed-off-by: David <me@davidcel.is>
* | | | | Merge pull request #21631 from RobinClowers/fix-cache-instrumentationJeremy Daer2015-10-091-0/+28
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix cache fetch instrumentation
| * | | | | Add test cases for Cache#fetch instrumentationRobin Clowers2015-09-141-0/+28
| | | | | |
* | | | | | Merge pull request #20600 from ↵Andrew White2015-10-021-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtsmfm/xmlschema-should-display-more-than-6-digits TimeWithZone#xmlschema should be able to display more than 6 digits
| * | | | | | TimeWithZone#xmlschema should be able to display more than 6 digitsFumiaki MATSUSHIMA2015-09-301-2/+2
| | | | | | |
* | | | | | | Regex fix for mattr_accessor validationAliaksandr Buhayeu2015-10-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change ^ and $ operators to \A and \z to prevent code injection after the line breaks
* | | | | | | Refactor AS::Callbacks halt config and fix the documentationRoque Pinel2015-10-011-2/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move from `AS::Callbacks::CallbackChain.halt_and_display_warning_on_return_false` to `AS::Callbacks.halt_and_display_warning_on_return_false` base on [this discussion](https://github.com/rails/rails/pull/21218#discussion_r39354580) Fix the documentation broken by 0a120a818d413c64ff9867125f0b03788fc306f8
* | | | | | Merge pull request #21767 from ronakjangir47/missing_transform_values_testRafael Mendonça França2015-09-251-0/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | Added missing tests for transform_values! which returns Enumerator
| * | | | | | Added missing tests for transform_values! which returns Enumerator without ↵Ronak Jangir2015-09-261-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | blocks
* | | | | | | Added missing tests for transform_keys! which returns Enumerator without blockRonak Jangir2015-09-261-0/+12
|/ / / / / /
* | | | | | Make `assert_difference` return the result of the yielded block.Lucas Mazza2015-09-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this we can perform new assertions on the returned value without having to cache it with an outer variable or wrapping all subsequent assertions inside the `assert_difference` block. Before: ``` post = nil assert_difference -> { Post.count }, 1 do Post.create end assert_predicate post, :persisted? ``` Now: ``` post = assert_difference -> { Post.count } do Post.create end assert_predicate post, :persisted? ```
* | | | | | Fix the AS::Callbacks terminator regression from 4.2.3Roque Pinel2015-09-221-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 4.2.3 AS::Callbacks will not halt chain if `false` is returned. That is the behavior of specific callbacks like AR::Callbacks and AM::Callbacks.
* | | | | | :hocho: TyposAkira Matsuda2015-09-211-1/+1
| | | | | |
* | | | | | :scissors: empty line at the top of filesAkira Matsuda2015-09-215-5/+0
|/ / / / /
* | | | | Merge pull request #21250 from ronakjangir47/safe_constYves Senn2015-09-071-0/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | safe_constantize - Added Object scoped missing test cases
| * | | | | safe_constantize - Added Object scoped missing test casesRonak Jangir2015-09-061-0/+2
|/ / / / /
* | | | | ArrayInquirer to correctly find symbols or stringsLeigh Halliday2015-08-281-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem existed where if your ArrayInquirer values were strings but you checked them using any? with a symbol, it would not find the value. Now it will correctly check whether both the String form or the Symbol form are included in the Array. `
* | | | | - Extracted `DELIMITED_REGEX` to `delimited_regex` method and made use of ↵Vipul A M2015-08-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user passed `options[:delimited_regex]` if available. Changed `DELIMITED_REGEX` to `DEFAULT)DELIMITED_REGEX` to signify what it means. - Added tests for number to delimited and number to currency in both actionview and activesupport. Changes Changes
* | | | | Removed duplicate requiring minitest/mock as it is already required in ↵Ronak Jangir2015-08-261-2/+0
| | | | | | | | | | | | | | | | | | | | method_call_assertions
* | | | | Cleaned up generators tests using internal assertion helperRonak Jangir2015-08-201-0/+6
|/ / / /
* | | | Replacing lambda with proc getting argument error because of it.Ronak Jangir2015-08-171-0/+6
| | | |
* | | | Merge pull request #21025 from ronakjangir47/assertsKasper Timm Hansen2015-08-131-0/+13
|\ \ \ \ | | | | | | | | | | Added helper methods to stub any instance
| * | | | Added helper methods to stub any instanceRonak Jangir2015-08-131-0/+13
| | | | |
* | | | | Assert that the `:prefix` option of `number_to_human_size` is deprecatedRoque Pinel2015-08-121-8/+10
|/ / / /
* | | | Deprecate :si prefix in number_to_human_size without replacementJean Boussier2015-08-101-9/+11
| | | |
* | | | Only invoke the default block for mattr_accessor once so that it does not ↵Lachlan Sylvester2015-08-071-0/+6
|/ / / | | | | | | | | | cause issues if it is not idempotent
* | | Small tweaks to mainly lock-ordering tests.thedarkone2015-07-221-21/+58
| | | | | | | | | | | | | | | | | | * only test the upgrade path, * add test to verify non upgrades can’t preempt, * add reentrancy assertion.
* | | Handle thread death during lock acquisitionMatthew Draper2015-07-211-0/+21
| | | | | | | | | | | | | | | | | | Specifically, clean up if the thread is killed while it's blocked awaiting the lock... if we get killed on some other arbitrary line, the result remains quite undefined.
* | | Adjust expectations around purpose/compatibility optionsMatthew Draper2015-07-211-8/+35
| | |
* | | Add some meta-assertions for the custom assertionsMatthew Draper2015-07-211-11/+63
| | | | | | | | | | | | | | | | | | I accidentally discovered `assert_threads_not_stuck` couldn't fail, so the simplest solution was to prove they're all now working in both directions.
* | | Order of execution is only guaranteed if upgradingMatthew Draper2015-07-211-1/+3
| | | | | | | | | | | | | | | If the thread isn't yet holding any form of lock, it has no claim over what may / may not run while it's blocked.
* | | Tests for AS::Concurrency::ShareLock.thedarkone2015-07-201-0/+194
| | |
* | | Fix `TimeWithZone#eql?` to handle `TimeWithZone` created from `DateTime`Roque Pinel2015-07-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby twz = DateTime.now.in_time_zone twz.eql?(twz.dup) => false ``` Now: ```ruby twz = DateTime.now.in_time_zone twz.eql?(twz.dup) => true ``` Please notice that this fix the `TimeWithZone` comparison to itself, not to `DateTime`. Based on #3725, `DateTime` should not be equal to `TimeWithZone`.
* | | ActiveSupport::HashWithIndifferentAccess select and reject should return ↵Bernard Potocki2015-07-171-0/+10
| | | | | | | | | | | | enumerator if called without block
* | | Expand coverage of JSON gem testsGodfrey Chan2015-07-111-16/+30
| | |
* | | Expand the JSON test coverage for Struct and Hash (?!)Godfrey Chan2015-07-111-1/+13
| | |