|
5 | 5 | expect(value).not_to receive(:dup).with(any_args) |
6 | 6 |
|
7 | 7 | subject = dereferenceable_subject(value) |
8 | | - expect(subject.value).to eq 'value' |
| 8 | + subject.value |
9 | 9 |
|
10 | 10 | subject = dereferenceable_subject(value, dup_on_deref: false) |
11 | | - expect(subject.value).to eq 'value' |
| 11 | + subject.value |
12 | 12 |
|
13 | 13 | subject = dereferenceable_subject(value, dup: false) |
14 | | - expect(subject.value).to eq 'value' |
| 14 | + subject.value |
15 | 15 | end |
16 | 16 |
|
17 | 17 | it 'calls #dup when the :dup_on_deref option is true' do |
18 | 18 | value = 'value' |
19 | 19 |
|
20 | 20 | subject = dereferenceable_subject(value, dup_on_deref: true) |
21 | 21 | expect(subject.value.object_id).not_to eq value.object_id |
22 | | - expect(subject.value).to eq 'value' |
23 | 22 |
|
24 | 23 | subject = dereferenceable_subject(value, dup: true) |
25 | 24 | expect(subject.value.object_id).not_to eq value.object_id |
26 | | - expect(subject.value).to eq 'value' |
27 | 25 | end |
28 | 26 |
|
29 | 27 | it 'defaults :freeze_on_deref to false' do |
30 | 28 | value = 'value' |
31 | 29 | expect(value).not_to receive(:freeze).with(any_args) |
32 | 30 |
|
33 | 31 | subject = dereferenceable_subject(value) |
34 | | - expect(subject.value).to eq 'value' |
| 32 | + subject.value |
35 | 33 |
|
36 | 34 | subject = dereferenceable_subject(value, freeze_on_deref: false) |
37 | | - expect(subject.value).to eq 'value' |
| 35 | + subject.value |
38 | 36 |
|
39 | 37 | subject = dereferenceable_subject(value, freeze: false) |
40 | | - expect(subject.value).to eq 'value' |
| 38 | + subject.value |
41 | 39 | end |
42 | 40 |
|
43 | 41 | it 'calls #freeze when the :freeze_on_deref option is true' do |
44 | 42 | value = 'value' |
45 | 43 |
|
46 | 44 | subject = dereferenceable_subject(value, freeze_on_deref: true) |
47 | 45 | expect(subject.value).to be_frozen |
48 | | - expect(subject.value).to eq 'value' |
49 | 46 |
|
50 | 47 | subject = dereferenceable_subject(value, freeze: true) |
51 | 48 | expect(subject.value).to be_frozen |
52 | | - expect(subject.value).to eq 'value' |
53 | 49 | end |
54 | 50 |
|
55 | 51 | it 'defaults :copy_on_deref to nil' do |
56 | 52 | value = 'value' |
57 | 53 |
|
58 | 54 | subject = dereferenceable_subject(value) |
59 | 55 | expect(subject.value.object_id).to eq(value.object_id) |
60 | | - expect(subject.value).to eq 'value' |
61 | 56 |
|
62 | 57 | subject = dereferenceable_subject(value, copy_on_deref: nil) |
63 | 58 | expect(subject.value.object_id).to eq(value.object_id) |
64 | | - expect(subject.value).to eq 'value' |
65 | 59 |
|
66 | 60 | subject = dereferenceable_subject(value, copy: nil) |
67 | 61 | expect(subject.value.object_id).to eq(value.object_id) |
68 | | - expect(subject.value).to eq 'value' |
69 | 62 | end |
70 | 63 |
|
71 | 64 | it 'calls the block when the :copy_on_deref option is passed a proc' do |
|
0 commit comments