Commit Graph

3489 Commits

Author SHA1 Message Date
Aaron Patterson
5921cf0b45 we still need describe as the implementation differs from minitest 2012-07-08 14:51:57 -07:00
Aaron Patterson
22bc12ec37 minitest provides "it" and "describe"
Remove rails implementation of describe, alias "test" to "it"
2012-07-08 10:54:21 -07:00
Aaron Patterson
3270156049 minitest is a gem dep, so remove this conditional 2012-07-08 10:50:21 -07:00
Aaron Patterson
6f74d36c42 activesupport gem dependencies should reflect the versions we actually use 2012-07-04 11:16:21 -07:00
Carlos Antonio da Silva
f3353895a0 Kill not used constant since removal of runner method
Runner method was removed in ada571bfcdbad669ae43a4dd18277ef227680a0b.
2012-07-03 21:02:49 -03:00
Aaron Patterson
ada571bfcd remove the runner method copied from minitest 2012-07-03 14:28:28 -07:00
Aaron Patterson
089da2e54d hook mocha in through m/t before_setup, after_teardown hooks 2012-07-03 14:28:28 -07:00
Xavier Noria
65dc45ea2d explains why the file update checker ignores mtimes in the future, plus a little refactor for the same price 2012-07-02 23:56:13 +02:00
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
d441de3697 Revert "Use strftime to convert DateTime to numeric"
There appears to be a bug with DateTime#strftime("%s") on 32-bit platforms.
Bug report: http://bugs.ruby-lang.org/issues/6683

This reverts commit 210cd756a628cc19c0d6e44bee8c33dfb2d9d598.
2012-07-01 17:27:49 +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
Andrew White
73bddd12a4 Remove rescue clause from ActiveSupport::TimeZone#to_f
Time#at no longer raises an error for large values so we can remove
the rescue clause from ActiveSupport::TimeZone#to_f.
2012-07-01 08:48:40 +01:00
Andrew White
c685d12c19 Remove DateTime#to_time override
Currently if the offset is not zero then to_time returns self which
can lead to errors where a developer assumes that the value is a
Time. To solve this we can use the native implementation of
DateTime#to_time in Ruby 1.9.3 as it handles offsets properly and
is faster than our override.
2012-07-01 08:02:41 +01:00
Andrew White
210cd756a6 Use strftime to convert DateTime to numeric
The native implementation of the seconds since the UNIX epoch in
strftime is significantly faster than our method.

Benchmark:
----------
require 'benchmark/ips'
require 'date'
require 'time'

date = DateTime.civil(1253,7,6,20,4,0)

Benchmark.ips do |x|
  x.report("strftime.to_i") { date.strftime('%s').to_i }
  x.report("ssue.to_i") { ((date - DateTime.civil(1970)) * 86400).to_i }

  x.report("strftime.to_f") { date.strftime('%s').to_f }
  x.report("ssue.to_f") { ((date - DateTime.civil(1970)) * 86400).to_f }
end

Output:
-------
Calculating -------------------------------------
       strftime.to_i     26480 i/100ms
           ssue.to_i     13818 i/100ms
       strftime.to_f     26561 i/100ms
           ssue.to_f     14479 i/100ms
-------------------------------------------------
       strftime.to_i   616937.3 (±2.4%) i/s - 3098160 in 5.024749s
           ssue.to_i   200108.8 (±6.9%) i/s -  994896 in 4.999278s
       strftime.to_f   553581.3 (±2.2%) i/s - 2788905 in 5.040397s
           ssue.to_f   204260.3 (±4.3%) i/s - 1028009 in 5.043072s
2012-07-01 07:55:41 +01:00
Vijay Dev
6b9d1a0db2 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activemodel/lib/active_model/errors.rb
2012-06-30 23:15:22 +05:30
Xavier Noria
58c83d4c61 make sure the inflection rules are loaded when cherry-picking active_support/core_ext/string/inflections.rb [fixes #6884] 2012-06-29 21:29:14 +02:00
abonec
20519efa6e fix FileUpdateChecker when file has wrong mtime (from future) 2012-06-29 19:43:33 +04:00
Alex Nisnevich
32c28e8214 Remove mention of convert_key now that it's been taken out in 1eecd9483b0439ab4913beea36f0d0e2aa0518c7 2012-06-28 20:10:58 -07:00
Grant Hutchins
f6bedc960d Speed up Hash#transform_keys using Hash#each_key
See https://gist.github.com/3007749 for justification
2012-06-27 20:09:30 -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
Bogdan Gusiev
88230b7cf7 AS::Callbacks: deprecate monkey patch code
Deprecate usage of filter object with #before and #after
methods as around callback
2012-06-26 09:21:36 +03:00
Rhett Sutphin
e6d4dc3ec4 Add missing require.
If you selectively require core_exts (e.g., require
'active_support/core_ext/string'), it is possible for
'active_support/core_ext/time/calculations' to be required when
`ActiveSupport::TimeWithZone` is not available. If this happens, the next call
to Time.=== will fail with a NameError.
2012-06-25 14:54:40 -05:00
Carlos Antonio da Silva
36d863ce51 Move constants to the top, remove freeze 2012-06-24 19:30:05 -03:00
Carlos Antonio da Silva
06d50b9d73 Remove some not used variables and improve code a bit 2012-06-24 19:30:05 -03:00
benolee
008023c29a correct line numbers for reader and writer methods 2012-06-24 14:39:49 -05:00
Francesco Rodriguez
bc7ac33846 add :nodoc: to internal implementations [ci skip] 2012-06-22 16:29:59 -05:00
Vijay Dev
35ee8fa3d8 Merge branch 'master' of github.com:lifo/docrails 2012-06-22 22:15:27 +05:30
Vijay Dev
6285675db1 fixes a few mistakes in api docs [ci skip] 2012-06-22 22:14:29 +05:30
Aaron Patterson
26a4e5e60e logger is a singleton, just flush the singleton 2012-06-20 14:21:23 -07:00
Aaron Patterson
b9f9951d5f use thread local queues.
Log listener is a singleton shared across threads, so make sure the
event queues are local to each thread.
2012-06-20 13:22:11 -07:00
paranoiase Kang
2773257ac6 Add prev_quarter and next_quarter method in Time/Date/DateTime 2012-06-20 11:39:11 -03:00
タコ焼き仮面
84403ae065 Correct the AP test。 2012-06-19 20:44:45 -07:00
Rafael Mendonça França
39dec69712 Run the logger tests in isolation 2012-06-19 23:21:00 -03:00
Rafael Mendonça França
453188568d CORES needs to be a integer 2012-06-19 23:13:47 -03:00
Aaron Patterson
265f13495f run railties tests in parallel, default to 2 cores 2012-06-19 17:08:23 -07:00
Aaron Patterson
056dbf4f11 Merge branch 'remote'
* remote:
  move fanout back to a global variable, add a mutex for safety
2012-06-19 15:33:40 -07:00
Aaron Patterson
bf8e20586b move fanout back to a global variable, add a mutex for safety 2012-06-19 15:33:14 -07:00
Aaron Patterson
a6fd462a80 make logger a singleton on the class 2012-06-19 14:41:31 -07:00
Aaron Patterson
c6af7646ad listeners are per thread, so remove nested hash 2012-06-19 14:41:31 -07:00
Francesco Rodriguez
7f66ee9ffe add documentation to AS::TestCase#assert_nothing_raised 2012-06-19 15:08:13 -05:00
Rafael Mendonça França
ceba010ea2 Add missing require 2012-06-19 17:04:07 -03:00
Francesco Rodriguez
b912bca9ac update AS::Testing::Assertions docs 2012-06-19 14:47:46 -05:00
Francesco Rodriguez
24587c26dd fix typo [ci skip] 2012-06-19 14:25:11 -05:00
Aaron Patterson
b2ca26a44c subscribers are per thread, so remove the nested hash access 2012-06-19 10:37:51 -07:00
Aaron Patterson
0b38152195 documenting concurrency rules for the Fanout class 2012-06-19 10:37:50 -07:00
Aaron Patterson
644a1796c6 remove global cache 2012-06-19 10:37:50 -07:00
Aaron Patterson
e4de78aec5 reduce thread locals 2012-06-19 10:37:50 -07:00
Aaron Patterson
a01d9dae1c make the fanout notifier local to the current thread 2012-06-19 10:37:50 -07:00
Carlos Antonio da Silva
808592bae2 Use map! instead of replace + map 2012-06-18 21:53:25 -03:00
Chris Zetter
8c07696f47 Fix lookup on HashWithIndifferentAccess for array values. 2012-06-18 21:49:43 -03:00