require "spec_helper" describe ImageFileList do describe "#to_css" do it "should handle mapping a prefix to autogenerated CSS classes" do ImageFileList.new('spec/samples/example.gif').to_css('premium', false).should match(/\.premium-example \{/) end it "should add a generator message to the top of files by default" do ImageFileList.new().to_css().split('\n').first.should eq("/* Generated with CSSquirt! (http://github.com/mroth/cssquirt/) */\n") end it "should allow the generator message to be disabled" do ImageFileList.new().to_css(nil, false).split('\n').first.should_not eq("/* Generated with CSSquirt! (http://github.com/mroth/cssquirt/) */\n") end end describe "#to_images" do it "should return an array of all ImageFiles" do fl = ImageFileList.new('spec/samples/*.png', 'spec/samples/*.gif').to_images fl.each { |file| file.should be_kind_of(ImageFile) } end it "should eat Exceptions and output errors to STDERR instead" do bad_eggs = 'spec/samples/*.mp3', 'spec/samples/toobig.gif' lambda { ImageFileList.new(bad_eggs).to_images }.should_not raise_error end end end