From 3d4a57c3c1cb2fe203946105c7fa7a508f0ce245 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sun, 12 Jun 2011 00:52:05 -0400 Subject: [PATCH] engine test --- test/units/sprites/engine_test.rb | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/units/sprites/engine_test.rb diff --git a/test/units/sprites/engine_test.rb b/test/units/sprites/engine_test.rb new file mode 100644 index 00000000..a172c518 --- /dev/null +++ b/test/units/sprites/engine_test.rb @@ -0,0 +1,43 @@ +require 'test_helper' + +class EngineTest < Test::Unit::TestCase + + def setup + sprite_filename = 'squares/ten-by-ten.png' + @images = [ + Compass::SassExtensions::Sprites::Image.new(nil, File.join(sprite_filename), {}) + ] + @engine = Compass::SassExtensions::Sprites::Engine.new(100, 100, @images) + end + + + test "should have width of 100" do + assert_equal 100, @engine.width + end + + test "should have height of 100" do + assert_equal 100, @engine.height + end + + test "should have correct images" do + assert_equal @images, @engine.images + end + + test "raises Compass::Error when calling save" do + begin + @engine.save('foo') + assert false, '#save did not raise an exception' + rescue Compass::Error + assert true + end + end + + test "raises Compass::Error when calling construct_sprite" do + begin + @engine.construct_sprite + assert false, '#construct_sprite did not raise an exception' + rescue Compass::Error + assert true + end + end +end \ No newline at end of file