Sha256: ad4a80bf9044fe393e0a9c097f7417c9f44728e7441446a64946350feb359792

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

require 'spec_helper'
require 'gnawrnip/image'

module Gnawrnip
  describe Image do
    before do
      Image.any_instance.stub(: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()
          canvas.should_receive(:resample_bilinear).with(320, 240).and_return(canvas)
          canvas
        end

        before do
          Image.any_instance.should_receive(:analysis).twice
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gnawrnip-0.2.5 spec/gnawrnip/image_spec.rb
gnawrnip-0.2.4 spec/gnawrnip/image_spec.rb
gnawrnip-0.2.3 spec/gnawrnip/image_spec.rb