File: _dummy_img__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 (26 lines) | stat: -rw-r--r-- 627 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
22
23
24
25
26
module Magick
  class Draw
    def self._dummy_img_
      @@_dummy_img_
    end
  end
end

RSpec.describe Magick::Draw, '._dummy_img_' do
  it 'works' do
    draw = described_class.new

    # cause it to become defined. save the object id.
    draw.get_type_metrics('ABCDEF')
    dummy = nil
    expect { dummy = described_class._dummy_img_ }.not_to raise_error

    expect(dummy).to be_instance_of(Magick::Image)

    # ensure that it is always the same object
    draw.get_type_metrics('ABCDEF')
    dummy2 = nil
    expect { dummy2 = described_class._dummy_img_ }.not_to raise_error
    expect(dummy).to eq dummy2
  end
end