Sha256: 71eb76218728d048f1a84091d3582801a5f7cfe273fc49da297d810fb410121f

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe Montage::Source do
  subject { Montage::Source }

  # --- image -----------------------------------------------------------------

  it { should have_public_method_defined(:image) }

  describe '#image' do
    before(:each) do
      @helper = Montage::Spec::ProjectHelper.new
      @helper.write_simple_config
      @helper.write_source('sprite_one/one', 100, 25)
    end

    it 'should return the Image instance path when the source file exists' do
      source = Montage::Source.new(@helper.path_to_source('sprite_one/one'))
      source.image.should be_a(Magick::Image)
    end

    it 'should raise an error when the source file does not exist' do
      running = lambda {
        Montage::Source.new(@helper.path_to_source('__invalid__')).image
      }

      running.should raise_error(Montage::MissingSource,
        /Couldn't find the source file/)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
montage-0.4.0 spec/montage/source_spec.rb
montage-0.3.0 spec/montage/source_spec.rb