ice_nine 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -15
- data/.travis.yml +8 -7
- data/Gemfile +10 -0
- data/Gemfile.devtools +5 -4
- data/README.md +4 -24
- data/benchmarks/speed.rb +4 -2
- data/config/flay.yml +2 -2
- data/config/flog.yml +1 -1
- data/config/reek.yml +9 -2
- data/config/rubocop.yml +0 -1
- data/ice_nine.gemspec +1 -0
- data/lib/ice_nine.rb +24 -9
- data/lib/ice_nine/core_ext/object.rb +17 -3
- data/lib/ice_nine/freezer.rb +43 -3
- data/lib/ice_nine/freezer/array.rb +6 -8
- data/lib/ice_nine/freezer/false_class.rb +2 -2
- data/lib/ice_nine/freezer/hash.rb +22 -9
- data/lib/ice_nine/freezer/hash/state.rb +3 -3
- data/lib/ice_nine/freezer/module.rb +2 -2
- data/lib/ice_nine/freezer/nil_class.rb +2 -2
- data/lib/ice_nine/freezer/no_freeze.rb +5 -6
- data/lib/ice_nine/freezer/numeric.rb +2 -2
- data/lib/ice_nine/freezer/object.rb +7 -8
- data/lib/ice_nine/freezer/range.rb +7 -8
- data/lib/ice_nine/freezer/rubinius.rb +2 -2
- data/lib/ice_nine/freezer/struct.rb +2 -2
- data/lib/ice_nine/freezer/symbol.rb +2 -2
- data/lib/ice_nine/freezer/true_class.rb +2 -2
- data/lib/ice_nine/support/recursion_guard.rb +48 -28
- data/lib/ice_nine/version.rb +3 -3
- data/spec/integration/ice_nine/class_methods/deep_freeze_bang_spec.rb +21 -0
- data/spec/integration/ice_nine/class_methods/deep_freeze_spec.rb +5 -254
- data/spec/shared/array_deep_freeze_shared_spec.rb +9 -0
- data/spec/shared/hash_deep_freeze_shared_spec.rb +23 -0
- data/spec/shared/ice_nine_deep_freeze_shared_spec.rb +263 -0
- data/spec/shared/no_freeze_deep_freeze_shared_spec.rb +19 -0
- data/spec/shared/object_deep_freeze_shared_spec.rb +19 -0
- data/spec/shared/range_deep_freeze_shared_spec.rb +13 -0
- data/spec/unit/ice_nine/class_methods/deep_freeze_bang_spec.rb +24 -0
- data/spec/unit/ice_nine/class_methods/deep_freeze_spec.rb +6 -19
- data/spec/unit/ice_nine/core_ext/object/deep_freeze_bang_spec.rb +24 -0
- data/spec/unit/ice_nine/core_ext/object/deep_freeze_spec.rb +3 -9
- data/spec/unit/ice_nine/freezer/array/class_methods/deep_freeze_spec.rb +0 -14
- data/spec/unit/ice_nine/freezer/false_class/class_methods/deep_freeze_spec.rb +1 -7
- data/spec/unit/ice_nine/freezer/hash/class_methods/deep_freeze_spec.rb +1 -29
- data/spec/unit/ice_nine/freezer/module/class_methods/deep_freeze_spec.rb +1 -7
- data/spec/unit/ice_nine/freezer/nil_class/class_methods/deep_freeze_spec.rb +1 -7
- data/spec/unit/ice_nine/freezer/no_freeze/class_methods/deep_freeze_spec.rb +3 -23
- data/spec/unit/ice_nine/freezer/numeric/class_methods/deep_freeze_spec.rb +3 -12
- data/spec/unit/ice_nine/freezer/object/class_methods/deep_freeze_spec.rb +0 -18
- data/spec/unit/ice_nine/freezer/range/class_methods/deep_freeze_spec.rb +0 -18
- data/spec/unit/ice_nine/freezer/struct/class_methods/deep_freeze_spec.rb +1 -11
- data/spec/unit/ice_nine/freezer/symbol/class_methods/deep_freeze_spec.rb +1 -7
- data/spec/unit/ice_nine/freezer/true_class/class_methods/deep_freeze_spec.rb +1 -7
- data/spec/unit/ice_nine/recursion_guard/frozen/guard_spec.rb +28 -0
- data/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb +31 -0
- data/spec/unit/object/deep_freeze_spec.rb +3 -9
- metadata +54 -41
- data/spec/unit/ice_nine/recursion_guard/class_methods/guard_spec.rb +0 -33
@@ -1,33 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'ice_nine/support/recursion_guard'
|
5
|
-
|
6
|
-
describe IceNine::RecursionGuard, '#guard' do
|
7
|
-
subject { object.guard(object_id, &method(:block)) }
|
8
|
-
|
9
|
-
let(:object) { IceNine::RecursionGuard.new }
|
10
|
-
let(:object_id) { 1 }
|
11
|
-
let(:return_value) { double('return_value') }
|
12
|
-
|
13
|
-
context 'when the block is not recursive' do
|
14
|
-
def block
|
15
|
-
return_value
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'returns the expected value' do
|
19
|
-
should equal(return_value)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'when the block is recursive' do
|
24
|
-
def block
|
25
|
-
expect(subject).to be_nil
|
26
|
-
return_value
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'returns the expected value' do
|
30
|
-
should equal(return_value)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|