File: element_assignment_spec.rb

package info (click to toggle)
ruby-rmagick 6.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,232 kB
  • sloc: cpp: 19,563; ruby: 17,147; sh: 88; javascript: 36; makefile: 13
file content (21 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
RSpec.describe Magick::Image, '#[]=' do
  it 'allows assignment of arbitrary properties' do
    image = described_class.new(20, 20)

    image['comment'] = 'str_1'
    image['label'] = 'str_2'
    image['jpeg:sampling-factor'] = '2x1,1x1,1x1'

    expect(image['comment']).to eq 'str_1'
    expect(image['label']).to eq 'str_2'
    expect(image['jpeg:sampling-factor']).to eq '2x1,1x1,1x1'
  end

  it 'raises an error when trying to assign properties to a frozen image' do
    image = described_class.new(20, 20)

    image.freeze

    expect { image['comment'] = 'str_4' }.to raise_error(RuntimeError)
  end
end