Sha256: 3a7a3ec5b98154421887a175a310cb83cf30bc1b1e4f79393320f7df652c7967

Contents?: true

Size: 840 Bytes

Versions: 7

Compression:

Stored size: 840 Bytes

Contents

require 'spec_helper'
require 'gnawrnip/image'

module Gnawrnip
  describe Image do
    before do
      allow_any_instance_of(Image).to receive(:canvas).and_return(canvas)
    end

    let(:image) do
      Image.new(GnawrnipTest.image('gnawrnip/image'))
    end

    context 'image size is 640x480' do
      let(:canvas) do
        double(width: 640, height: 480, save: nil)
      end

      describe '.width' do
        subject { image.width }
        it { should eql 640 }
      end

      describe '.height' do
        subject { image.height }
        it { should eql 480 }
      end

      describe '.resize' do
        let(:canvas) do
          canvas = super()
          expect(canvas).to receive(:resample_bilinear!).with(320, 240).once
          canvas
        end

        it { image.resize(320, 240) }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gnawrnip-0.8.0 spec/gnawrnip/image_spec.rb
gnawrnip-0.7.0 spec/gnawrnip/image_spec.rb
gnawrnip-0.6.0 spec/gnawrnip/image_spec.rb
gnawrnip-0.5.0 spec/gnawrnip/image_spec.rb
gnawrnip-0.4.0 spec/gnawrnip/image_spec.rb
gnawrnip-0.3.2 spec/gnawrnip/image_spec.rb
gnawrnip-0.3.1 spec/gnawrnip/image_spec.rb