Sha256: fec80d0a41767c3a2008e48471dc42cbb0056e5ad1c258f42dfa037a0b7cd2be

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

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(dimension: dimension, save: nil)
      end

      let(:dimension) do
        double(width: 640, height: 480)
      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).and_return(canvas)
          canvas
        end

        before do
          expect_any_instance_of(Image).to receive(:analysis).twice
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gnawrnip-0.3.0 spec/gnawrnip/image_spec.rb