aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
diff options
context:
space:
mode:
authorRoque Pinel <repinel@gmail.com>2015-06-14 23:46:18 -0400
committerRoque Pinel <repinel@gmail.com>2015-06-15 08:46:20 -0400
commitc1a694d9d275cb8a895eff4d3b727f691b5d5838 (patch)
tree81526ddec2abee3ba6e0a849512f46cb7aa4a44d /activejob
parent7e30085bd09448318b8963e96401fb12b4edcb9e (diff)
downloadrails-c1a694d9d275cb8a895eff4d3b727f691b5d5838.tar.gz
rails-c1a694d9d275cb8a895eff4d3b727f691b5d5838.tar.bz2
rails-c1a694d9d275cb8a895eff4d3b727f691b5d5838.zip
Fix inflector test by using dup inflections when it needs to be changed
This is not something that is failing at the moment, but can do it eventually. I had the issue with db62081 as the HEAD and with the following change: ``` --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -101,6 +101,7 @@ class InflectorTest < ActiveSupport::TestCase def test_acronyms ActiveSupport::Inflector.inflections do |inflect| inflect.acronym("API") + inflect.acronym("HTM") inflect.acronym("HTML") inflect.acronym("HTTP") inflect.acronym("RESTful") ``` I was expecting only `test_acronyms` to fail, but with a specific `seed` others were also failing: `ruby -w -I"lib:test" test/inflector_test.rb --seed 4313`. Now, `inflections` instance is duplicated on `setup` and restored on `teardown`. I decided to benchmark and check the impact of the patch and it seems to me to be fine. ``` Calculating ------------------------------------- without changes 1.000 i/100ms with setup dup 1.000 i/100ms with block dup 1.000 i/100ms ------------------------------------------------- without changes 0.817 (± 0.0%) i/s - 5.000 in 6.119916s with setup dup 0.784 (± 0.0%) i/s - 4.000 with block dup 0.797 (± 0.0%) i/s - 4.000 ``` Where `with setup dup` duplicates on setup for each test and `with block` duplicates for just for tests that actually modify `inflections`.
Diffstat (limited to 'activejob')
0 files changed, 0 insertions, 0 deletions