Sha256: 4e485d11670cb59f7e9739f9b3ca79cb75ea1357a4725e3449496055923ed4ae

Contents?: true

Size: 948 Bytes

Versions: 2

Compression:

Stored size: 948 Bytes

Contents

require 'spec_helper'
require 'gnawrnip/animation'

module Gnawrnip
  describe Animation do
    before do
      Animation.reset!
      Animation.add_frame
      Animation.add_frame
    end

    describe '.add_frame' do
      subject { Animation.frames }
      it { should have(2).elements }
    end

    describe '.reset!' do
      before { Animation.reset! }
      subject { Animation.frames }
      it { should be_empty }
    end

    describe '.generate' do
      before do
        ::Magick::ImageList.any_instance.stub(:initialize) do |*filenames|
          @file_length = filenames.length
        end
        ::Magick::ImageList.any_instance.stub(:delay=)
        ::Magick::ImageList.any_instance.stub(:write) do |path|
          File.write(path, @file_length.to_s)
        end
      end

      subject { Animation.generate }
      it 'should be base64 encoded string for each files.' do
        should == "Mg==\n"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gnawrnip-0.0.3 spec/gnawrnip/animation_spec.rb
gnawrnip-0.0.2 spec/gnawrnip/animation_spec.rb