To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / b1 / b1bf1d96c8982d9d19b70df31949c7bb6b7d7f65.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (2.35 KB)
| 1 |
require File.dirname(__FILE__) + '/../test_helper' |
|---|---|
| 2 |
|
| 3 |
class AssetsTest < Test::Unit::TestCase |
| 4 |
def setup |
| 5 |
Engines::Assets.mirror_files_for Engines.plugins[:test_assets] |
| 6 |
end |
| 7 |
|
| 8 |
def teardown |
| 9 |
FileUtils.rm_r(Engines.public_directory) if File.exist?(Engines.public_directory) |
| 10 |
end |
| 11 |
|
| 12 |
def test_engines_has_created_base_public_file |
| 13 |
assert File.exist?(Engines.public_directory) |
| 14 |
end |
| 15 |
|
| 16 |
def test_engines_has_created_README_in_public_directory |
| 17 |
assert File.exist?(File.join(Engines.public_directory, 'README')) |
| 18 |
end |
| 19 |
|
| 20 |
def test_public_files_have_been_copied_from_test_assets_plugin |
| 21 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets')) |
| 22 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'file.txt')) |
| 23 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder')) |
| 24 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets', 'subfolder', 'file_in_subfolder.txt')) |
| 25 |
end |
| 26 |
|
| 27 |
def test_engines_has_not_created_duplicated_file_structure |
| 28 |
assert !File.exists?(File.join(Engines.public_directory, "test_assets", RAILS_ROOT)) |
| 29 |
end |
| 30 |
|
| 31 |
def test_public_files_have_been_copied_from_test_assets_with_assets_dir_plugin |
| 32 |
Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_assets_directory] |
| 33 |
|
| 34 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory')) |
| 35 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'file.txt')) |
| 36 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'subfolder')) |
| 37 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_assets_directory', 'subfolder', 'file_in_subfolder.txt')) |
| 38 |
end |
| 39 |
|
| 40 |
def test_public_files_have_been_copied_from_test_assets_with_no_subdirectory_plugin |
| 41 |
Engines::Assets.mirror_files_for Engines.plugins[:test_assets_with_no_subdirectory] |
| 42 |
|
| 43 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_no_subdirectory')) |
| 44 |
assert File.exist?(File.join(Engines.public_directory, 'test_assets_with_no_subdirectory', 'file.txt')) |
| 45 |
end |
| 46 |
|
| 47 |
def test_public_files_have_NOT_been_copied_from_plugins_without_public_or_asset_directories |
| 48 |
Engines::Assets.mirror_files_for Engines.plugins[:alpha_plugin] |
| 49 |
|
| 50 |
assert !File.exist?(File.join(Engines.public_directory, 'alpha_plugin')) |
| 51 |
end |
| 52 |
end |