Andrew White
822c858a1a
Improve performance of DateTime#seconds_since_unix_epoch
...
Calculate the seconds since the UNIX epoch using the difference in
Julian day numbers from the epoch date. By reducing the Rational math
to just the offset component this gives a significant improvement.
Benchmark:
Calculating --------------------------------------------
new 27733 i/100ms
current 15031 i/100ms
new 27737 i/100ms
current 15549 i/100ms
--------------------------------------------------------
new 548182.1 (±0.9%) i/s - 2745567 in 5.008943s
current 216380.9 (±1.6%) i/s - 1082232 in 5.002781s
new 510281.9 (±1.2%) i/s - 2551804 in 5.001525s
current 219858.3 (±1.8%) i/s - 1103979 in 5.023039s
2012-07-02 07:05:17 +01:00
Andrew White
98b46bf5e2
Make Time#change work with offsets other than UTC or local
...
Use Time.new to create times where the current offset is not zero or
not in the local time zone - closes #4847 and #6651 .
2012-07-01 09:11:21 +01:00
Carlos Antonio da Silva
33192cfa07
Fix failing test in file update checker
...
Introduced in 1abe31670fdad2c357b4356b40a4567a46d16693
The test was failing when running on isolation, because the extensions were
not being loaded, thus 1.year.from_now was failing. Just use mktime
instead, adding 1 year to Time.now.
2012-06-29 15:08:08 -03:00
abonec
20519efa6e
fix FileUpdateChecker when file has wrong mtime (from future)
2012-06-29 19:43:33 +04:00
Carlos Antonio da Silva
60571b8539
Ensure Array#to_sentence does not modify given hash
...
Also simplify I18n logic for Array#to_sentence, doing only one lookup
for all keys and using merge!, instead of one lookup for each option key.
2012-06-26 22:05:56 -03:00
Carlos Antonio da Silva
d6aea126de
Get rid of the clear_i18n hack by using a different locale
...
Use a different and very specific locale for testing currency negative
format, and an empty store for currency defaults.
2012-06-24 19:30:06 -03:00
Carlos Antonio da Silva
dc766c9e7b
Move number helper i18n related tests to AS
...
They also make more sense here since all the related logic with I18n is
handled by AS::NumberHelper, and not by AV anymore.
2012-06-24 19:30:06 -03:00
Godfrey Chan
fe933be5e2
Adds missing inflector tests to ensure idempotency
...
This is a follow up to #4719 . It appears that singularize and pluralize
are supposed to be idempotent - i.e. when you call singularize or
pluralize multiple times on the same string, you should get the same
result. (At least for the "officially supported" cases that the stock
inflector is designed to handle.) #4719 added the missing tests for
regular cases, and this commit added the missing tests for the
irregularities.
While I'm at that, I also synced up the irregularity test cases with
the current set of irregularity cases that we ship out-of-the-box.
2012-06-21 02:16:48 -07:00
paranoiase Kang
2773257ac6
Add prev_quarter and next_quarter method in Time/Date/DateTime
2012-06-20 11:39:11 -03:00
Mike Gehard
db03f13255
Remove extra test case.
...
Make the test description better reflect what is happening
2012-06-19 11:56:16 -06:00
Chris Zetter
8c07696f47
Fix lookup on HashWithIndifferentAccess for array values.
2012-06-18 21:49:43 -03:00
タコ焼き仮面
c6d86a5db4
make events not use date and time to determine parent_of. fixes #5932
2012-06-18 16:34:23 -07:00
Aaron Patterson
56a1bb2f10
raise the same exception in order to keep path info
...
Ruby 2.0.0 implements LoadError#path, but newly raised load errors will
not contain the path information. Replace the error message, copy
blame, and rereaise the same exception object
2012-06-12 16:19:51 -07:00
Akira Matsuda
fa2af42cdb
Proc always respond_to :binding
2012-06-12 01:43:28 +09:00
Xavier Noria
d3a99c32d1
removes the obsolete require_association method from dependencies
...
This is an obsolete method from the very early days,
apparently it was used circa 2004 because STI support
was not smart enough. This method is not public
interface, and we are heading a major version, so
removal seems right.
2012-06-10 00:38:40 +02:00
Andrew White
870310db6a
Eliminate dependency on Rails::VERSION::STRING
...
To facilitate the use of ActiveSupport::Testing::Performance outside
of a Rails application conditionally check for the presence of
Rails::VERSION::STRING before including it in the environment string.
2012-06-05 20:43:41 +01:00
Francesco Rodriguez
5e1d40f773
add instance_accessor option to ActiveSupport::Configurable#config_accessor
...
Changes:
* Add `instance_accessor` option to opt out of the instance writer and
instance reader methods.
* Raises a NameError if the name of the attribute is not valid.
* Update documentation and tests.
* Add CHANGELOG entry in activesupport.
2012-06-05 10:50:48 -05:00
Andrew White
67b94799c2
Reduce warning messages when running Active Support tests
...
Eliminate the warnings generated by redefining methods and constants.
2012-05-31 17:18:25 +01:00
Piotr Sarnacki
aab0d4e2c6
Merge pull request #6554 from erichmenge/remove-json-variable
...
Remove deprecated ActiveSupport::JSON::Variable.
2012-05-30 13:04:33 -07:00
Erich Menge
1f5dddcf2f
Remove deprecated ActiveSupport::JSON::Variable.
2012-05-30 14:39:00 -05:00
Rafael Mendonça França
d5025f15d8
Merge pull request #6541 from tjouan/tj/activesupport-fix-tests-requiring-unsafe-umask
...
Make tests pass with umask
2012-05-30 12:15:21 -07:00
Erich Menge
1e335ad138
True, False, and Nil should be represented in as_json as themselves.
2012-05-29 21:13:03 -05:00
Thibault Jouan
7b6bf02303
Make File#atomic_write tests pass with umask
...
Assertions on file permissions only pass with some combinations of
file create mode and the process file mode creation mask. This mask
should be applied on the file create mode before related assertions.
2012-05-29 21:01:03 +00:00
Arun Agrawal
3335cb7f12
JRuby return different Array for module contents.
...
Test was failing against JRuby.
It loads like [Constant3 Constant1]
2012-05-29 17:30:12 +05:30
José Valim
6ba93ac6f6
Merge pull request #6525 from freerange/minitest-passthrough-exceptions
...
Exceptions like Interrupt & NoMemoryError should not be rescued in tests.
2012-05-29 01:35:40 -07:00
Andrew Mutz
598f8bdda1
decoupling activesupport performance testing from actionview and adding tests
2012-05-28 21:09:20 -07:00
James Mead
b057fab638
Exceptions like Interrupt should not be rescued.
...
Neither Test::Unit nor MiniTest rescue exceptions like Interrupt or
NoMemoryError, but ActiveSupport::Testing::SetupAndTeardown#run which
overrides MiniTest::Unit::TestCase#run rescues them.
Rescuing an Interrupt exception is annoying, because it means when you
are running a lot of tests e.g. when running one of the rake test tasks,
you cannot break out using ctrl-C.
Rescuing exceptions like NoMemoryError is foolish, because the most
sensible thing to happen is for the process to terminate as soon as
possible.
This solution probably needs some finessing e.g. I'm not clear whether
the assumption is that only MiniTest is supported. Also early versions
of MiniTest did not have this behaviour. However, hopefully it's a
start.
Integrating with Test::Unit & MiniTest has always been a pain. It would
be great if both of them provided sensible extension points for the kind
of things that both Rails and Mocha want to do.
2012-05-28 22:44:28 +01:00
Jared Beck
371508c240
Fix handling of negative zero in number_to_currency
2012-05-28 04:42:53 -04:00
Andrew Mutz
155cd5e6b5
Moving NumberHelpers from ActionView to ActiveSupport
2012-05-27 18:14:21 -07:00
Li Ellis Gallardo
38813da6dc
Truncate now has the ability to receive a html option that allows it to call rails helpers.
...
This way if my text is long I don't have to do something like this:
.text
= truncate(@text, :length => 27)
if @text.size >= 27
= link_to "continue", notes_path, ....."")
2012-05-26 10:24:17 -05:00
Alexey Vakhov
b4167d3f3e
Fix Range#sum optimized version
...
At 1bd4d1c67459a91415ee73a8f55d2309c0d62a87 was added Range#sum
optimized version for arithmetic progressions. This improvment injected
a defect with not integer range boundaries. The defect was fixed by
e0adfa82c05f9c975005f102b4bcaebfcd17d241. The second commit really
disabled optimization at all because in Ruby integer-valued numbers are
instances of Fixnum and Bignum classes. We should #use is_a?
(#kind_of?) method instead #instance_of? to check if value is numerical:
1.class # => Fixnum
1.instance_of?(Integer) # => false
1.is_a?(Integer) # => true
-100_000_000_000.class # => Bignum
-100_000_000_000.instance_of?(Integer) # => false
-100_000_000_000.is_a?(Integer) # => true
Moreover original implementation of Range#sum has a defect with reverse
range boundaries. If the first boundary is less than the second range is
empty. Current commit fixes and tests this case too.
2012-05-25 17:46:53 +04:00
Carlos Antonio da Silva
317f49493a
Add missing requires for deep_dup and hash ext test
2012-05-24 19:18:28 -03:00
Rafael Mendonça França
b0ebdf3e74
Use deep_dup in the deep_transform_keys tests.
...
Using only dup make some tests to not catch up an implementation error
because the methods were changing the nested hashes.
Related to:
541429fbe4 (L1R96)
2012-05-24 18:13:52 -03:00
Mark McSpadden
2b5b60fc3c
Add Hash#deep_transform_keys and Hash#deep_transform_keys! Also convert deep_*_keys to use deep_transform_keys.
2012-05-23 13:11:06 -05:00
Lucas Húngaro
a4bb195c91
Adding deep versions of stringify_keys and symbolize_keys (plain and bang) for nested hashes
2012-05-23 11:56:10 -03:00
Mark McSpadden
6ff887321b
Add Hash#transform_keys and Hash#transform_keys! and refactor *_keys methods to use them.
2012-05-23 09:08:04 -05:00
Angelo capilleri
5646d65d01
changed xml type datetime to dateTime, fixes #6328
...
XmlMini define the xml 'datatime', but according to
http://www.w3.org/TR/xmlschema-2/#dateTime could be better
change this to 'dateTime' with upper case letter 'T.
So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime'
add the changing to the changelog
2012-05-23 14:45:56 +02:00
Michael Koziarski
e44009aa2b
Merge pull request #5125 from winston/log_exception_when_cache_read_fails
...
#read_entry in ActiveSupport::Cache::FileStore should log details of the exception when an exception is thrown
2012-05-21 19:02:48 -07:00
Alexey Vakhov
e4569b50d1
Add instance_accessor option to class_attribute
2012-05-22 00:28:34 +04:00
kennyj
e5e2ba14c3
Don't use assert_block method. It will be deprecated.
2012-05-20 00:14:40 +09:00
Andrew White
3d0e4895cd
Handle case where ancestor is not the end of the chain
2012-05-19 15:47:35 +01:00
Marc-Andre Lafortune
eb09411460
Fix constantize so top level constants are looked up properly.
2012-05-19 15:47:35 +01:00
Marc-Andre Lafortune
99e9a733c8
Make constantize look down the ancestor chain (excluding Object)
2012-05-19 15:47:35 +01:00
Jeremy Kemper
98657ad10c
Merge pull request #6376 from jgaskins/timestamp-microseconds
...
Increase numeric-timestamp precision to nanoseconds
2012-05-18 17:30:35 -07:00
Jamie Gaskins
900dbc54f1
Increase AR#cache_key
precision to nanoseconds
2012-05-19 08:20:08 +08:00
Jeremy Kemper
40bdf553a0
Merge pull request #6183 from nashby/fix-issue-6179
...
wrap time ranges with timezones
2012-05-18 14:10:25 -07:00
kennyj
5c02e305fe
Fix warning: possibly useless use of % in void context
2012-05-19 05:32:43 +09:00
Vasiliy Ermolovich
3b1c30c99f
doesn't modify params in SafeBuffer#%
2012-05-18 18:30:48 +03:00
Vasiliy Ermolovich + Sergey Nartimov
dcdde7da48
respect nsec in TimeWithZone
...
when we pass fractional usec to Time methods we should use Rational
instead of Float because of accuracy problem
Time.local(2011,6,12,23,59,59,999999.999).nsec
# => 999999998
Time.local(2011,6,12,23,59,59,Rational(999999999, 1000)).nsec
# => 999999999
2012-05-18 13:07:52 +03:00
José Valim
6950d74e18
Merge pull request #6361 from markmcspadden/issue_6265
...
Remove special cases for duplicable? on Class and Module
2012-05-17 00:07:10 -07:00
Mark McSpadden
2f06d5842b
Remove special cases for duplicable? on Class and Module
2012-05-17 03:00:31 -04:00
José Valim
313f292e27
Ensure blocks given to subscriber are properly yield
2012-05-17 08:52:40 +02:00
Vasiliy Ermolovich
e2e513621d
wrap time ranges with timezones, closes #6179
2012-05-17 08:24:42 +03:00
Anuj Dutta
bc51ad957a
Fix an issue with inflection where my_analyses (in plular form) incorrectly converted to my_analyasis(in singular form).
2012-05-16 22:58:03 +01:00
Vasiliy Ermolovich
9fb21e98e2
fix safe string interpolation with SafeBuffer#%, closes #6352
2012-05-16 21:05:26 +03:00
Aaron Patterson
1c3e5bee3d
Merge pull request #5571 from jarkko/5559-fix-dst-jump-bug-on-master
...
[#5559 ] Do not black out the system timezone DST jump hour if Time.zone ...
2012-05-15 08:24:25 -07:00
Vasiliy Ermolovich
a1f695287b
remove useless tests for Range#step
2012-05-13 20:10:31 +03:00
Santiago Pastorino
1c481be331
Remove blockless_step leave all that up to Ruby
...
Closes #6297
2012-05-13 13:44:39 -03:00
Vijay Dev
70237e7dd3
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
activesupport/lib/active_support/callbacks.rb
2012-05-12 19:10:49 +05:30
Vasiliy Ermolovich
b8f394f4a3
Object#try can't call private methods
2012-05-12 14:07:21 +03:00
Santiago Pastorino
36dd1857dc
Remove useless load path modifications
2012-05-11 19:00:35 -03:00
Edward Tsech
21190f37f8
Test Hash#except can receive more than one argument.
2012-05-11 14:09:55 +02:00
Edward Tsech
1065ef8fd3
Fix copypaste. [ci skip]
2012-05-11 11:11:41 +02:00
grosser
b5005b6259
add unless_exist option to memory store
2012-05-10 08:19:45 -07:00
Francesco Rodriguez
c1ce4144d1
AS::Callbacks#run_callbacks remove key argument
2012-05-10 02:21:03 -05:00
Xavier Noria
ed2feb7962
Merge pull request #6064 from gazay/fix_guides_for_as_core_ext
...
Fix guides for as core ext
2012-05-07 13:01:58 -07:00
Alexey Gaziev
8b67a022ec
Added tests for comparsion operator for Range
2012-05-07 23:53:57 +04:00
Piotr Sarnacki
98553a5574
Keep all methods in object/deep_dup
2012-05-06 11:13:15 -07:00
Alexey Gaziev
657b4ff04a
Nice logic for deep_dup in rails
2012-05-06 10:28:35 -07:00
José Valim
d6e2c81cfe
Merge pull request #6169 from marcandre/respond_to_missing
...
Respond to missing
2012-05-05 00:34:13 -07:00
Marc-Andre Lafortune
14762dc5ef
Use respond_to_missing for TimeWithZone
2012-05-05 02:45:04 -04:00
Marc-Andre Lafortune
9bda37474e
Use respond_to_missing? for Chars
2012-05-05 02:44:58 -04:00
Marc-Andre Lafortune
3ea70f985b
Use respond_to_missing? for OrderedOptions
2012-05-05 02:43:41 -04:00
Jeremy Kemper
fecfd61c22
Merge pull request #6156 from mjtko/feature-beginning_of_hour
...
Beginning and end of hour support for Time and DateTime
2012-05-04 15:34:11 -07:00
Mark J. Titorenko
6223d72b52
enable tests for beginning_of_* and end_of_* within time zone tests; enable test for future_with_time_current_as_time_with_zone; fix beginning_of_month test.
2012-05-04 16:11:32 +01:00
Mark J. Titorenko
8c3f4bec1f
added beginning_of_hour support to core_ext calculations for Time and DateTime
2012-05-04 16:01:57 +01:00
Aaron Patterson
7a3e43cc58
Merge pull request #4452 from tapajos/e5425c8f68fbb720fcbf4b14e1f154ac27dbbbed
...
Fix cache (FileStore) clear to keep .gitkeep.
2012-05-03 15:56:54 -07:00
David FRANCOIS
18aa1ae29c
BigDecimal string wrapping in JSON serialization can now be opted-out, fixes #6033
2012-05-02 07:16:00 +02:00
Sebi Burkhard
d538778808
JSON: encode BigDecimal NaN/Infinity as null.
2012-05-01 11:28:46 +07:00
Piotr Sarnacki
3cc6995e71
Merge pull request #2532 from hasclass/as_json__encode_infinite_and_nan_floats_as_null
...
JSON: Encode infinite or NaN floats as `null` to generate valid JSON.
2012-04-30 21:06:22 -07:00
José Valim
66c5ac3be9
Merge pull request #5177 from cap10morgan/fix-gh-issue-4374
...
fix inflector bug where -ice gets singularized into -ouse
2012-04-30 00:13:40 -07:00
José Valim
0b019cc3b8
Merge pull request #6044 from gazay/tests_for_string_truncate_w_regexp_separator
...
Tests for regexp separator in String#truncate
2012-04-29 03:08:41 -07:00
Alexey Gaziev
076536433f
Tests for regexp separator in String#truncate
...
5a7513593f
2012-04-29 13:42:40 +04:00
Carlos Antonio da Silva
34599c4f57
Add test for default silence and stderr deprecation behaviors
2012-04-28 18:25:35 -03:00
Daniel Schierbeck
1bac04e854
Optimize the performance of #delegate
...
Remove the use of #__send__ in order to boost performance. This also
means that you can no longer delegate to private methods on the
target object.
2012-04-12 13:47:52 +02:00
Xavier Noria
206974a97c
adds a new test case for titleize
2012-04-08 01:10:08 +02:00
Xavier Noria
4b685aad7b
revises the regexp used in titleize
...
The regexp used in titleize matches saxon genitive
and other contractions, only to call capitalize on
the captured text and have the apostrophe upcased
which yields the apostrophe itself. It is more
clear that the regexp matches just what it has to
match.
2012-04-07 23:58:44 +02:00
Xavier Noria
e25eeed5b8
the file update checker now also detects removed files
2012-04-03 16:18:56 -07:00
Arun Agrawal
27a8e693da
no more deprecation required.
2012-03-31 23:00:13 +05:30
Arun Agrawal
6a240826ca
No more BufferedLogger so it can be LoggerTest
2012-03-31 22:49:15 +05:30
Arun Agrawal
40c38d969c
warning removed: (...) interpreted as grouped expression
2012-03-31 16:31:07 +05:30
Aaron Patterson
ad95a61b62
Merge pull request #4911 from Floppy/master
...
Reduce FILENAME_MAX_SIZE in ActiveSupport::Cache::FileStore
2012-03-30 17:43:55 -07:00
Dmitry Plashchynski
96b951ce24
validate attribute names in class and module attribute accessors
2012-03-30 15:45:46 +03:00
Vasiliy Ermolovich
633ee64e20
String#titleize works properly with smart quotes, closes #5584
2012-03-26 21:18:25 +03:00
Jarkko Laine
03becb1309
[ #5559 ] Do not black out the system timezone DST jump hour if Time.zone differs from that.
...
The system timezone DST jump hour should not be blacked out by Time.zone.parse if current Time.zone does not do the jump at that time.
Fixes #5559 .
2012-03-24 20:15:00 +02:00
Sergey Nartimov
2ee28b2bf8
fix HashWithIndifferentAccess.[] method
2012-03-23 23:09:29 +03:00
Aaron Patterson
ea482d366a
oops, forgot to commit the tests! 💣
2012-03-23 11:47:42 -07:00
Sergey Nartimov
9c857db757
deprecate Proc#bind that can cause symbol memory leak
2012-03-22 22:25:55 +03:00
Aaron Patterson
440559f661
bigdecimal can be duped on Ruby 2.0
2012-03-20 09:51:22 -07:00
kennyj
c5b3cbc7e8
Add missing require
2012-03-20 23:11:27 +09:00
FND
e0ee14ed23
Provide access to logger instance within TaggedLogging blocks
...
this improves encapsulation, simplifying occurrences like the following:
Rails.logger.tagged("DEBUG") { Rails.logger.debug(msg) }
... by removing the need to rely on (i.e. repeat) outer variables:
Rails.logger.tagged("DEBUG") { |logger| logger.debug(msg) }
2012-03-19 10:49:27 +01:00
Aaron Patterson
273054d6e1
remove some mocha stubs
2012-03-16 11:24:52 -07:00
Carlos Antonio da Silva
c045eebd5d
Remove deprecation from AS::Deprecation behavior, some minor cleanups
...
* Refactor log subscriber, use select! to avoid a new object
* Remove deprecation messages related to AS::Deprecation behavior
This was added about 2 years ago for Rails 3:
d4c7d3fd94
* Remove some not used requires
* Refactor delegate to avoid string conversions and if statements inside each block
2012-03-16 09:01:48 -03:00
Sandeep
15404fd3da
fixed - warning: assigned but unused variable - checker
2012-03-16 17:14:54 +05:30
Jon Rowe
4073505065
escape commas in paths before globbing to avoid infinite hang in Dir[]
2012-03-15 12:21:20 +00:00
Erich Menge
be623677a3
Allow retrieve_cache_key to work on collections such as ActiveRecord::Relation.
2012-03-12 12:29:30 -05:00
Rafael Mendonça França
9f69f01569
Remove warning of unused variable
2012-03-08 23:58:05 -03:00
Aaron Patterson
085cb3b9af
Merge pull request #5287 from nashby/hash-slice-extract
...
refactor Hash#slice and Hash#extract!
2012-03-08 09:54:34 -08:00
José Valim
d1a4faf61f
Ensure load hooks can be called more than once with different contexts.
2012-03-06 22:05:07 +01:00
Vasiliy Ermolovich
74cb4b63bd
refactor Hash#slice and Hash#extract!
2012-03-06 08:33:14 +03:00
Vishnu Atrai
d8996d3cab
remove usages of AS::OrderedHash
2012-03-03 23:48:29 +05:30
Aaron Patterson
139963c99a
Merge branch 'master-security'
...
* master-security:
Ensure [] respects the status of the buffer.
delete vulnerable AS::SafeBuffer#[]
use AS::SafeBuffer#clone_empty for flushing the output_buffer
add AS::SafeBuffer#clone_empty
fix output safety issue with select options
Conflicts:
actionpack/lib/action_view/helpers/tags/base.rb
2012-03-01 09:56:04 -08:00
José Valim
8ccaa34103
Ensure [] respects the status of the buffer.
2012-02-29 16:09:02 -08:00
Xavier Noria
699ba8ab52
Merge pull request #4284 from mattdbridges/time_calculation_aliases
...
Added aliases for prev_year, prev_month, and prev_week in Time and Date calculations
2012-02-28 01:37:19 -08:00
Wes Morgan
16e7f2f809
fix inflector bug where -ice gets pluralized into -ouse
...
This should happen for mouse or louse, but not slice or pumice.
2012-02-25 14:22:15 -07:00
Xavier Noria
31ceb5e67b
decouples the implementation of the inflector from its test suite
...
Trying alternative implementations of the inflections
is hard because the suite is coupled with the current
one, setting ivars by hand etc. This commit relies on
initialize_dup, as long as you maintain that one you
can tweak the implementation.
2012-02-24 15:06:17 -08:00
Bogdan Gusiev
10bac29b33
AS::Callbacks: deprecate rescuable option
2012-02-22 17:43:13 +02:00
Winston
b52c66f1be
#read_entry in ActiveSupport::Cache::FileStore should log details of the exception when an exception is thrown.
2012-02-22 19:19:05 +08:00
Matt Bridges
d6366625e0
Adding :last_week, :last_month, and :last_year aliases to Time and Date
...
core extensions
2012-02-21 16:27:08 -06:00
Akira Matsuda
71d8c77e5a
delete vulnerable AS::SafeBuffer#[]
2012-02-20 16:02:45 -08:00
Akira Matsuda
71b95bd954
add AS::SafeBuffer#clone_empty
2012-02-20 16:02:44 -08:00
Xavier Noria
fd5d9b366c
fixes a regression introduced by 532cd4, and a bogus test in AP the regression uncovered
2012-02-10 22:17:30 -08:00
Xavier Noria
6728191494
Merge pull request #4719 from markmcspadden/singularize_words_that_end_in_ss
...
Add Inflection test (and fixes) to ensure singularizing a singular actually give you the correct singular in more cases
2012-02-10 11:14:10 -08:00
Shigeya Suzuki
6f68e63274
make Range#overlaps? accept Range of Time
2012-02-09 22:08:28 -08:00
Xavier Noria
827b520bd1
Merge pull request #4878 from vijaydev/ordinal-2072
...
PR #2072 with docs
2012-02-07 14:08:02 -08:00
James Smith
c33334fc92
Change FILENAME_MAX_SIZE in FileStore to 228.
...
In order that temp filenames generated from it will fit in 255 chars. See https://github.com/rails/rails/issues/4907
2012-02-06 17:03:26 +00:00
kennyj
9abdabf185
Optional start_day argument for Time#all_week.
...
Closes #4883
2012-02-06 00:20:16 +09:00
Vijay Dev
a470d79697
Document Integer#ordinal available in PR #2072 .
...
Also remove an unasserted line in the tests.
2012-02-04 18:46:19 +05:30
Tim Gildea
6fa0190fe4
Add ActiveSupport::Inflector.ordinal and Integer#ordinal
2012-02-04 18:25:54 +05:30
Vijay Dev
7a72fdc7dc
remove unasserted line in test
2012-02-04 18:24:17 +05:30
Bogdan Gusiev
4f53091dd1
AS::Callbacks: rip out per_key option.
2012-02-04 13:31:00 +02:00
Dmitriy Vorotilin
705a1d5b88
Added as_json method for multibyte strings
2012-02-01 02:06:46 +04:00
David Heinemeier Hansson
83dbef6074
Revert "Fix expanding cache key for single element arrays"
...
This reverts commit abe915f23777efe10f17d611bf5718ca855a0704.
This broke all existing keys and it's wrong anyway. The array is just there as a convenience option for building the string. It's intentional that [ "stuff"] and "stuff" generates the same key.
2012-01-27 20:44:08 +01:00
Mark McSpadden
532cd49530
Add Inflection test (and fixes) to ensure singularizing a singular actually give you the correct singular in more cases
2012-01-27 02:20:13 -06:00
Alex Tambellini
7598284c0b
safe_constantize should handle wrong constant name NameErrors Fixes #4710
2012-01-26 14:19:49 -05:00
Aaron Patterson
ef7fc6ebb3
global variables may not be set depending on the match. fixes #4703
2012-01-26 09:24:14 -08:00
brainopia
b258bec431
Deprecate DateTime.local_offset
2012-01-25 23:04:40 +04:00
kennyj
5e59d75536
Fix GH #4344 . A defined callback in extended module is called too.
2012-01-24 17:36:30 +09:00
Aaron Patterson
a0da46ecaf
pushed broadcasting down to a module
2012-01-20 14:18:29 -08:00
Aaron Patterson
14d1029aa3
fixed test for more informative message
2012-01-20 11:57:07 -08:00
Aaron Patterson
e7e1890c49
made the broadcast logger quack more like a logger
2012-01-20 11:57:07 -08:00
Aaron Patterson
d42b3d4347
add a broadcasting logger so we can split logs
2012-01-20 11:57:07 -08:00
kennyj
d8b06dc5c2
Convert URI.parser.parse to URI.parse, and remove ruby 1.8.x code.
2012-01-19 20:27:16 +09:00
Marcos Tapajos
e5425c8f68
Cache (FileStore) clear should keep .gitkeep
2012-01-13 13:28:16 -02:00
Xavier Noria
04df7bb02c
deprecates Module#local_constant_names
2012-01-12 12:17:35 -08:00
Aaron Patterson
b15d2c0708
require minitest rather than test/unit
2012-01-06 15:50:47 -08:00
Aaron Patterson
f65559fcc2
make sure the test case name is nil
2012-01-06 15:17:08 -08:00
Aaron Patterson
056b8386d0
removing unnecessary requires
2012-01-06 14:43:04 -08:00
Aaron Patterson
0579f303ec
rescue the assertion exception
2012-01-06 14:01:02 -08:00
Aaron Patterson
f8964bd546
add the class name to the assertion message
2012-01-06 13:58:55 -08:00
Rafael Mendonça França
2fc3a30e17
Remove more references to Test::Unit
2012-01-06 15:36:36 -03:00
Rafael Mendonça França
b2fca9533e
No need to check if MiniTest::Assertions is defined
2012-01-06 13:31:39 -03:00
Rafael Mendonça França
3ca7fa96f7
Remove unneeded tests
2012-01-06 13:31:39 -03:00
Norman Clarke
cac15643cf
Implement Chars#swapcase.
2012-01-06 12:06:26 -03:00
Rafael Mendonça França
61fd7cd9ed
Require ActiveSupport::TestCase form ActiveSupport isolation tests
2012-01-06 01:14:21 -03:00
Aaron Patterson
b8d8c50785
use AS::TestCase as the base class
2012-01-05 17:12:46 -08:00
José Valim
4751cc21e8
Merge pull request #4332 from norman/multibyte
...
Putting AS::Multibyte on a Ruby 1.9 diet
2012-01-05 13:46:39 -08:00
Norman Clarke
16bee7618c
Use friendlier method name
2012-01-05 17:25:40 -03:00
Norman Clarke
3fe7ca1dbe
Replace Unicode.u_unpack with String#codepoints
2012-01-05 17:08:27 -03:00
Norman Clarke
51648a6fee
Remove multibyte utils
...
This is neither a public API, nor used internally, so let's remove it.
2012-01-05 17:02:14 -03:00
Norman Clarke
b81bef531c
Just use Ruby's String#[]=
2012-01-05 16:26:24 -03:00
Karunakar (Ruby)
0023643522
Moved all the logger methods to active support logger
...
minor
2012-01-06 00:38:46 +05:30
Norman Clarke
f49febe1db
Merge branch 'refactor-multibyte-chars' of https://github.com/lest/rails into multibyte
...
Conflicts:
activesupport/lib/active_support/multibyte/chars.rb
2012-01-05 15:19:00 -03:00
Aaron Patterson
1dbbe7b663
Merge pull request #4316 from wrozka/time_advance_nsec
...
Time advance nsec bug
2012-01-05 09:08:30 -08:00
Vishnu Atrai
c776075add
parse only minitest results in isolation test
2012-01-05 21:05:13 +05:30
Sergey Nartimov
7301aa2e0d
refactor AS::Multibyte::Chars
2012-01-05 18:25:27 +03:00
Norman Clarke
c4b522d3c8
Make return value from bang methods match Ruby docs
...
The docs for the String class indicate that methods like `rstrip!` and
others should return nil when they do not have an effect on the string.
2012-01-05 11:51:10 -03:00
Norman Clarke
963c36004c
Fix incorrect behavior specified in test.
...
This test was actually specifying the opposite of what it should.
2012-01-05 10:50:25 -03:00
Pawel Pierzchala
c766f3e4b0
Nano seconds fraction of time is copied properly in Time#advance
...
When day, month or year was passed, advance created a new time
ignoring previous nsec fraction. Now nsec is passed through
usec as a Rational number.
2012-01-05 13:23:13 +01:00
Rafael Mendonça França
7d26fad384
No need to require psych since require yaml does that.
2012-01-04 14:29:13 -03:00
Rafael Mendonça França
761b049b2e
No need to use rescue block to require psych
2012-01-04 13:30:57 -03:00
Rafael Mendonça França
38b9fbf1d9
Whitespaces ✂️
2012-01-04 12:39:28 -03:00
Rafael Mendonça França
73a0f9df47
Add test to make sure that add two safe buffers always return a safe buffer
2012-01-04 12:37:20 -03:00
Xavier Noria
e04232e904
Merge pull request #4250 from lest/range-json
...
use #to_s to convert Range to json
2012-01-02 13:53:52 -08:00
José Valim
44df252382
Merge pull request #4252 from lest/deprecate-activesupport-base64
...
remove ActiveSupport::Base64 in favor of ::Base64
2012-01-02 11:54:00 -08:00
Sergey Nartimov
0f2f8003d2
remove ActiveSupport::Base64 in favor of ::Base64
2012-01-02 22:48:15 +03:00
Vijay Dev
881ca628b0
fix a warning about grouped expressions
2012-01-01 23:01:28 +05:30
Sergey Nartimov
dc05914be7
use #to_s to convert Range to json
2012-01-01 20:16:10 +03:00
Sergey Nartimov
952e9d9005
refactor Range#include? to handle ranges with floats
2011-12-29 13:26:52 +03:00
Vasiliy Ermolovich
a19d0f5a66
deprecate Base64.encode64s from AS. Use Base64.strict_encode64 instead
2011-12-27 22:46:44 +03:00
Vasiliy Ermolovich
a7ba8e1fb3
remove File#to_path alias
2011-12-25 22:22:22 +03:00
Sergey Nartimov
1e9e88fcd3
remove checks for encodings availability
2011-12-25 14:34:58 +03:00
Sergey Nartimov
5ca86ac8f9
deprecate String#encoding_aware? and remove its usage
2011-12-24 15:57:54 +03:00
Aaron Patterson
367741ef22
Revert "Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH*"
...
This reverts commit 4d20de8a50d889a09e6f5642984775fe796ca943.
Conflicts:
activesupport/CHANGELOG.md
activesupport/lib/active_support/core_ext/enumerable.rb
activesupport/test/core_ext/enumerable_test.rb
2011-12-22 12:21:18 -07:00
Vasiliy Ermolovich
c4df2d0b6e
deprecate Array#uniq_by and Array#uniq_by! in favor of Array#uniq and Array#uniq! from ruby 1.9
2011-12-22 19:34:39 +03:00
Sergey Nartimov
4f6af26a88
remove AS whiny nil extension and deprecate config.whiny_nils
2011-12-22 10:28:36 +03:00
lest
f1b4cacbae
remove Enumerable#each_with_object from core_ext as it is present in ruby 1.9
2011-12-21 19:07:00 +03:00
lest
a57c6441a8
remove Kernel#singleton_class from core_ext as it is present in ruby 1.9
2011-12-21 18:53:38 +03:00
Vasiliy Ermolovich
c52ce1dae2
remove Array#sample from core_ext
2011-12-21 17:31:40 +03:00
Uģis Ozols
ee69ef62a8
Remove some of the ActiveSupport core extensions related to 1.8.
2011-12-21 09:29:59 +02:00
José Valim
fb1c06a694
Remove more dead code from AS.
2011-12-20 18:38:20 +01:00
José Valim
7ab4775106
Initial pass at removing dead 1.8.x code from Active Support.
...
There are a bunch of other implicit branches that adds
1.8.x specific code that still needs to be removed. Pull
requests for those cases are welcome.
2011-12-20 18:22:21 +01:00
José Valim
6a6fc4e1db
Remove deprecations from Active Support.
2011-12-20 15:18:42 +01:00
Aaron Patterson
572c3d5178
* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger
...
from Ruby stdlib.
2011-12-19 18:41:37 -08:00
José Valim
4f35d5a18b
Merge pull request #4007 from exviva/expand_cache_key_for_one_element_array
...
Fix expanding cache key for single element arrays
2011-12-16 14:40:09 -08:00
Olek Janiszewski
abe915f237
Fix expanding cache key for single element arrays
...
In short:
expand_cache_key(element) should not equal expand_cache_key([element])
This way a fragment cache key for an index page with only a single
element in the collection is different than a fragment cache for a
typical show page for that element.
2011-12-16 17:58:25 +01:00
José Valim
80256abb39
FileUpdateChecker should be able to handle deleted files.
2011-12-13 11:23:21 +01:00
José Valim
1f5b9bbdb3
Clean up FileUpdateChecker API.
2011-12-13 10:07:02 +01:00
lest
8a9cf790db
missing require in activesupport test
2011-12-13 10:33:58 +03:00
José Valim
ffa8bfeed9
Merge pull request #3954 from bdurand/null_store_2
...
Add ActiveSupport::Cache::NullStore for testing and development
2011-12-12 14:03:50 -08:00
José Valim
fa1d9a884c
Speed up development by only reloading classes if dependencies files changed.
...
This can be turned off by setting `config.reload_classes_only_on_change` to false.
Extensions like Active Record should add their respective files like db/schema.rb and db/structure.sql to `config.watchable_files` if they want their changes to affect classes reloading.
Thanks to https://github.com/paneq/active_reload and Pastorino for the inspiration. <3
2011-12-12 22:54:04 +01:00
José Valim
62cda03fa8
Provide a dir => extension API to file update checker.
2011-12-12 22:54:04 +01:00
Brian Durand
04d5eae4e8
Add ActiveSupport::Cache::NullStore to expose caching interface without actually caching for development and test environments.
2011-12-12 13:40:29 -06:00
José Valim
9a51053c1d
Update checker returns a boolean if callback was executed or not.
2011-12-12 19:41:17 +01:00
José Valim
57e0c038d6
Allow FileUpdateChecker to work with globs.
2011-12-12 14:57:09 +01:00
Miles Georgi
3d6eafe32e
Overrode Hash#nested_under_indifferent_access in HashWithIndifferentAccess
...
to return self.
2011-12-11 13:08:50 -08:00
José Valim
cd7fbcbba8
Fix AS test suite.
2011-12-10 11:17:00 +01:00
Aaron Patterson
04ef93dae6
* ActiveSupport::BufferedLogger#silence is deprecated. If you want to squelch
...
logs for a certain block, change the log level for that block.
* ActiveSupport::BufferedLogger#open_log is deprecated. This method should
not have been public in the first place.
* ActiveSupport::BufferedLogger's behavior of automatically creating the
directory for your log file is deprecated. Please make sure to create the
directory for your log file before instantiating.
* ActiveSupport::BufferedLogger#auto_flushing is deprecated. Either set the
sync level on the underlying file handle like this:
f = File.open('foo.log', 'w')
f.sync = true
ActiveSupport::BufferedLogger.new f
Or tune your filesystem. The FS cache is now what controls flushing.
* ActiveSupport::BufferedLogger#flush is deprecated. Set sync on your
filehandle, or tune your filesystem.
2011-12-09 16:05:57 -08:00
José Valim
d1abf29e79
Remove NilClass whiners feature.
...
Removing this feature causes boost in performance when using Ruby 1.9.
Ruby 1.9 started to do implicit conversions using `to_ary` and `to_str`
in some STDLIB methods (like Array#join). To do such implicit conversions,
Ruby 1.9 always dispatches the method and rescues the NoMethodError exception
in case one is raised.
Therefore, since the whiners feature defined NilClass#method_missing, such
implicit conversions for nil became much, much slower. In fact, just defining
NilClass#method_missing (even without the whiners feature) already causes a
massive slow down. Here is a snippet that shows such slow down:
require "benchmark"
Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }
class NilClass
def method_missing(*args)
raise NoMethodError
end
end
Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }
2011-12-08 20:28:09 +01:00
Mark Rushakoff
6f253fb440
Fix inflection regexes for mouse, mice
2011-12-07 23:14:02 -08:00
Aaron Patterson
c24928c3ad
Merge pull request #3845 from sumbach/test-return-value-from-require
...
Add tests for the return value of require
2011-12-04 11:22:09 -08:00
Sam Umbach
cfc467f73e
Simplify load and require tests
...
- These tests don't use autoloading so there's no need to add anything to autoload_paths
2011-12-03 13:11:02 -05:00
Sam Umbach
2a9f063082
Test that require and load raise LoadError if file not found
2011-12-03 13:08:18 -05:00
Sam Umbach
0a485309a0
Test return value of ActiveSupport::Dependencies::Loadable#load
2011-12-03 12:58:41 -05:00
Sam Umbach
93580f4936
Test return value of ActiveSupport::Dependencies::Loadable#require
...
- Add tests to protect from regressions in require's return value behavior
- See a10606c490471d8e1483acb3b31d7f2d51e9ebbe (require needs to return true or false) for the original bug fix
2011-12-03 11:52:25 -05:00
Jon Jensen
0e17cf17eb
Restore performance of ERB::Util.html_escape
...
Revert html_escape to do a single gsub again, but add the "n" flag (no
language, i.e. not multi-byte) to protect against XSS via invalid utf8
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-12-03 10:36:52 +01:00
David Heinemeier Hansson
4d20de8a50
Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH*
2011-12-02 13:00:56 +01:00
José Valim
38ab982cff
Log 'Filter chain halted as CALLBACKNAME rendered or redirected' every time a before callback halts.
2011-11-30 09:53:09 +01:00
Aaron Patterson
d9c2882077
Module#synchronize is deprecated with no replacement. Please use monitor
from ruby's standard library.
2011-11-29 15:40:46 -08:00
Yehuda Katz
3c81fc3b91
Merge pull request #3767 from tadast/object_in
...
Object#in? also accepts multiple parameters
2011-11-26 18:10:48 -08:00
Tadas Tamošauskas
ebf69ab163
Object#in? also accepts multiple parameters
2011-11-26 23:51:09 +00:00
Vijay Dev
d157ca881b
add more tests for monday and sunday methods
2011-11-26 23:53:57 +05:30
Arun Agrawal
cd6c5677fb
Tests added for monday and sunday
...
Reference commits :
a8f2860d0e7db86c61bb70935006100b04667ab1
80ac4dc6d0632937ccf61b38bc15fc2f6e27b18b
2011-11-26 23:37:01 +05:30
gregolsen
3f1a4c3415
beginning_of_week extended in both Time and Date so that to return week start based on start day that is monday by default
2011-11-25 12:02:49 -08:00
José Valim
7fcc8c0a1f
Rely solely on active_model_serializer and remove the fancy constant lookup.
2011-11-23 23:45:27 +00:00
José Valim
0536ea8c78
Add safe_constantize to ActiveSupport::Dependencies.
2011-11-23 21:43:03 +00:00
José Valim
3ee0116c94
Optimize cache expansion by skipping rails cache id in nested keys.
2011-11-23 18:22:09 +00:00
Olek Janiszewski
a650dd05f8
Fix #3737 AS::expand_cache_key generates wrong key in certain situations (part 2)
...
`nil` and `false` both expand to `""` (empty string), while `true` expands to
`"true"`; `false` should expand to `"false"`
2011-11-23 18:11:38 +01:00
Olek Janiszewski
d8e6dc9cf1
Fix #3737 AS::expand_cache_key generates wrong key in certain situations
...
`cache_key` method is never called when the argument is a 1-element array
with something that responds to `cache_key`
2011-11-23 18:06:16 +01:00
Yehuda Katz
a93ee92da2
Merge pull request #3725 from marcandre/twz_eql
...
Fix inconsistencies with Time{WithZone}#{hash,eql?}
2011-11-22 13:01:37 -08:00
Marc-Andre Lafortune
a4912078c7
Fix inconsistencies with Time{WithZone}#{hash,eql?}
2011-11-22 15:37:16 -05:00
Xavier Noria
8f57bf207f
tests predicates according to the boolean interpretation of their return value, not expecting specifically true or false
...
Respecting Genuine assert_equal false Edition
2011-11-21 14:22:16 -08:00
José Valim
401393b656
Deprecate InstanceMethods namespace handling in ActiveSupport::Concern.
...
This avoids the unnecessary "yo dawg, I heard you like include, so I put a module that includes your module when it is included" approach when building extensions.
2011-11-21 22:17:35 +00:00
Xavier Noria
f312e2142b
Revert "tests predicates according to the boolean interpretation of their return value, not expecting specifically true or false"
...
Reason: there were some genuine tests for false when
reading values, going to revise those ones.
This reverts commit a539a5e3f3be68f027d3dfe43f88dc9f0642c743.
2011-11-21 14:14:11 -08:00
Xavier Noria
a539a5e3f3
tests predicates according to the boolean interpretation of their return value, not expecting specifically true or false
2011-11-21 14:11:40 -08:00
Xavier Noria
f3554777b2
cache entry: options[:compressed] is a regular flag, no need for !!
2011-11-21 14:01:53 -08:00
Vijay Dev
83bf0b626c
refactor test_multiple_of
2011-11-16 02:36:36 +05:30
José Valim
a625523e75
Don't marshal dump twice when using encryptor.
2011-11-09 20:21:52 -02:00
José Valim
71e84a3b51
Deprecated ActiveSupport::MessageEncryptor#encrypt and decrypt.
2011-11-09 20:04:42 -02:00
Aaron Patterson
6a29ea04ae
Merge pull request #3549 from luckydev/rmethod
...
remove_method tests and changes
2011-11-07 03:02:26 -08:00
Anand
aabd61af8e
added remove_method core_ext tests
2011-11-07 16:22:52 +05:30
Henrik Hodne
9a7d916ceb
Removed argument throwing warnings when running tests.
...
The last argument to DateTime.new/civil is the Julian day number for
when the calendar reform occured. DateTime ignores it if it's 0, and
sets it to the default of DateTime::ITALY instead, so we could just
leave it out. This also removes the warnings while running the
ActiveSupport tests (there still are some for the setup though).
2011-11-06 17:35:02 +01:00
Pavan Kumar Sunkara
1934b77406
Added the test case for #3537
2011-11-06 19:22:46 +05:30
Xavier Noria
d287e90870
implements AS::Notifications.subscribed, which provides subscriptions to events while a block runs
2011-11-05 12:02:54 -07:00
Vijay Dev
55621504b0
make class name consistent with the filename
2011-11-05 22:31:39 +05:30
Xavier Noria
11f6795b23
defines Module#qualified_const_(defined?|get|set) and String#deconstantize
...
This commit also implements a faster version of #demodulize I was unable
to isolate with git add --patch.
Not a big fan of the name #deconstantize. It complements #demodulize
getting rid of the rightmost constant, hence the name, but it is
unrelated to the well-known #constantize. So unsure. Could not come
with anything better, please feel free to rename.
2011-10-29 18:10:45 -07:00
Xavier Noria
0fc531392d
let demodulize do less work, and add tests
...
This is also faster on 1.9.
2011-10-29 01:07:54 -07:00
José Valim
771ca79f74
Revert "Merge pull request #3395 from bdurand/fix_file_store_cleanup"
...
Tests were failing on Travis-CI.
This reverts commit 79d01a8f16e20c556a086a2f07e3ccb4400f9819, reversing
changes made to b838570bd69ff13d677fb43e79f10d6f3168c696.
2011-10-25 22:23:25 +02:00
Arun Agrawal
b6fc41275c
Unused variable removed
2011-10-24 21:56:27 +05:30
José Valim
79d01a8f16
Merge pull request #3395 from bdurand/fix_file_store_cleanup
...
Fix ActiveSupport::Cache::FileStore.cleanup to actually work.
2011-10-21 12:42:06 -07:00