File: object_deep_freeze.rb

package info (click to toggle)
ruby-ice-nine 0.11.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 432 kB
  • sloc: ruby: 1,006; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 404 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# encoding: utf-8

shared_examples 'IceNine::Freezer::Object.deep_freeze' do
  before do
    value.instance_eval { @a = '1' }
  end

  it 'returns the object' do
    should be(value)
  end

  it 'freezes the object' do
    expect { subject }.to change(value, :frozen?).from(false).to(true)
  end

  it 'freezes instance variables' do
    expect(subject.instance_variable_get(:@a)).to be_frozen
  end
end