File: engine_test.rb

package info (click to toggle)
ruby-compass 0.12.2~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,308 kB
  • sloc: ruby: 10,474; makefile: 42; xml: 14
file content (48 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'test_helper'

class EngineTest < Test::Unit::TestCase
  include SpriteHelper
  def setup
    create_sprite_temp
    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

  def taredown
    clean_up_sprites
  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