File: image_list_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 (31 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# rubocop:disable Style/CollectionMethods
RSpec.describe Magick::ImageList do
  it 'does not have certain array methods' do
    image_list = described_class.new(*FILES[0..9])

    expect { image_list.assoc }.to raise_error(NoMethodError)
    expect { image_list.flatten }.to raise_error(NoMethodError)
    expect { image_list.flatten! }.to raise_error(NoMethodError)
    expect { image_list.join }.to raise_error(NoMethodError)
    expect { image_list.pack }.to raise_error(NoMethodError)
    expect { image_list.rassoc }.to raise_error(NoMethodError)
  end

  it 'has certain enumerable methods' do
    image_list = described_class.new(*FILES[0..9])

    expect { image_list.detect { true } }.not_to raise_error

    image_list.each_with_index { |image, _n| expect(image).to be_instance_of(Magick::Image) }

    expect { image_list.entries }.not_to raise_error
    expect { image_list.include?(image_list[0]) }.not_to raise_error
    expect { image_list.inject(0) { |_acc, _elem| 0 } }.not_to raise_error
    expect { image_list.max }.not_to raise_error
    expect { image_list.min }.not_to raise_error
    expect { image_list.sort }.not_to raise_error
    expect { image_list.sort_by(&:signature) }.not_to raise_error
    expect { image_list.zip }.not_to raise_error
  end
end
# rubocop:enable Style/CollectionMethods