Sha256: 7969e7ebd6f05c5c3b330dc64de36165b4c3eb00b5d0d543a93c5d60cfd159d7

Contents?: true

Size: 810 Bytes

Versions: 8

Compression:

Stored size: 810 Bytes

Contents

RSpec.describe Magick::Image, '#properties' do

  let(:img) { Magick::Image.new(20, 20) }
  let(:freeze_error) { RUBY_VERSION[/^1\.9|^2/] ? RuntimeError : TypeError }

  before(:each) do
    img['a'] = 'str_1'
    img['b'] = 'str_2'
    img['c'] = 'str_3'
  end

  it 'allows assignment of arbitrary properties' do
    expect(img['a']).to eq 'str_1'
    expect(img['b']).to eq 'str_2'
    expect(img['c']).to eq 'str_3'
    expect(img['d']).to be nil
  end

  it 'returns a hash of assigned properties' do
    expected_properties = { 'a' => 'str_1', 'b' => 'str_2', 'c' => 'str_3' }
    expect(img.properties).to eq(expected_properties)
  end

  it 'raises an error when trying to assign properties to a frozen image' do
    img.freeze
    expect { img['d'] = 'str_4' }.to raise_error(freeze_error)
  end

end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 spec/rmagick/image/properties_spec.rb
rmagick-windows-2.16.4 spec/rmagick/image/properties_spec.rb
rmagick-windows-2.16.3 spec/rmagick/image/properties_spec.rb
rmagick-windows-2.16.2 spec/rmagick/image/properties_spec.rb
rmagick-windows-2.16.1 spec/rmagick/image/properties_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/spec/rmagick/image/properties_spec.rb
rmagick-2.16.0 spec/rmagick/image/properties_spec.rb
rmagick-2.15.4 spec/rmagick/image/properties_spec.rb