Sha256: 3bd6b4a0eac74ba90fb7f303fcb75e0bb6ca0b34d2a95803e0f4f07f56626ac3

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'helper'
require 'fileutils'

class RunnerTest < Test::Unit::TestCase

  def setup
    initialize_application_or_load_sprites!

    assert_false Rails.application.sprites.all.empty?

    assert_nothing_raised do
      Rails.application.sprites.generate!
    end
  end

  def teardown
    FileUtils.rm_rf(Rails.root.join('public/images/sprites'))
    FileUtils.rm_rf(Rails.root.join('public/stylesheets/sprites'))

    tear_down_assets
  end


  def test_generate
    visit "/sprite?sprite_path=/images/#{Rails.application.sprites['sprites/4.png'].path}"
    assert_equal 2400, page.find('#sprite').native.height
  end

  def test_generate_2
    visit "/sprite?sprite_path=/images/#{Rails.application.sprites['sprites/3.png'].path}"
    assert_equal 96, page.find('#sprite').native.height
  end
  
  def test_sprite_exists
    assert File.exists?(Rails.root.join('public/images/sprites/3.png'))
    assert File.exists?(Rails.root.join('public/images/sprites/4.png'))
  end
  
  def test_stylesheets_exists
    assert File.exists?(Rails.root.join('public/stylesheets/sprites/3.css'))
    assert File.exists?(Rails.root.join('public/stylesheets/sprites/4.css'))
  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/runner_test.rb
active_assets-0.2.0.rc3 test/active_assets/active_sprites/runner_test.rb
active_assets-0.2.0.rc2 test/active_assets/active_sprites/runner_test.rb
active_assets-0.2.0.rc test/active_assets/active_sprites/runner_test.rb