Sha256: 089a45708d475f04bc70c05b3f9a745f73998cdfe8a1c9d866b5e607e13ccfe0

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require 'helper'

class SpriteTest < Test::Unit::TestCase
  def setup
    initialize_application_or_load_sprites!
  end

  def teardown
    tear_down_assets
  end

  def sprites
    Rails.application.sprites
  end

  def test_underscore_method
    assert_nothing_raised do
      Rails.application.sprites do
        sprite :foo do
          _"sprite_images/foo/1.png" => '.my_klass'
        end
      end
    end
  end

  def test_underscore_method_actually_adds_the_sp
    Rails.application.sprites do
      sprite :bar, :orientation => :horizontal do
        _"sprite_images/foo/1.png" => '.my_klass'
      end
    end

    path = "sprite_images/foo/1.png"
    assert sprites[:bar].has_sprite_piece_with_path?(path)
    assert_equal '.my_klass', sprites[:bar][path].css_selector
  end

  def test_sprite_validation
    assert_raises ActiveAssets::ActiveSprites::Sprite::ValidationError do
      Rails.application.sprites do
        sprite ''
      end
    end
  end

  def test_raises_invalid_orientation
    assert_raises ActiveAssets::ActiveSprites::Sprite::OrientationInvalid do
      Rails.application.sprites do
        sprite :bar, :orientation => :bad
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_assets-0.2.0.rc4 test/active_assets/active_sprites/sprite_test.rb
active_assets-0.2.0.rc3 test/active_assets/active_sprites/sprite_test.rb
active_assets-0.2.0.rc2 test/active_assets/active_sprites/sprite_test.rb
active_assets-0.2.0.rc test/active_assets/active_sprites/sprite_test.rb