From f7aa26c58e498122c848dad2a9301fb9e72e20a1 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 21 Nov 2009 13:29:16 -0800 Subject: [PATCH] Add a test case for relative asset handling. --- test/compass_test.rb | 11 ++++++++++- .../stylesheets/relative/assets/images/testing.png | 0 test/fixtures/stylesheets/relative/config.rb | 9 +++++++++ test/fixtures/stylesheets/relative/css/ie.css | 1 + test/fixtures/stylesheets/relative/css/print.css | 1 + test/fixtures/stylesheets/relative/css/screen.css | 1 + test/fixtures/stylesheets/relative/sass/ie.sass | 6 ++++++ test/fixtures/stylesheets/relative/sass/print.sass | 6 ++++++ test/fixtures/stylesheets/relative/sass/screen.sass | 3 +++ 9 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/stylesheets/relative/assets/images/testing.png create mode 100644 test/fixtures/stylesheets/relative/config.rb create mode 100644 test/fixtures/stylesheets/relative/css/ie.css create mode 100644 test/fixtures/stylesheets/relative/css/print.css create mode 100644 test/fixtures/stylesheets/relative/css/screen.css create mode 100644 test/fixtures/stylesheets/relative/sass/ie.sass create mode 100644 test/fixtures/stylesheets/relative/sass/print.sass create mode 100644 test/fixtures/stylesheets/relative/sass/screen.sass diff --git a/test/compass_test.rb b/test/compass_test.rb index eb155b15..4d570fed 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -9,7 +9,7 @@ class CompassTest < Test::Unit::TestCase end def teardown - teardown_fixtures :blueprint, :empty, :compass, :image_urls + teardown_fixtures :blueprint, :empty, :compass, :image_urls, :relative end def teardown_fixtures(*project_names) @@ -55,6 +55,15 @@ class CompassTest < Test::Unit::TestCase end end + def test_image_urls + within_project('relative') do |proj| + each_css_file(proj.css_path) do |css_file| + assert_no_errors css_file, 'relative' + end + assert_renders_correctly :screen + end + end + private def assert_no_errors(css_file, project_name) file = css_file[(tempfile_path(project_name).size+1)..-1] diff --git a/test/fixtures/stylesheets/relative/assets/images/testing.png b/test/fixtures/stylesheets/relative/assets/images/testing.png new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/stylesheets/relative/config.rb b/test/fixtures/stylesheets/relative/config.rb new file mode 100644 index 00000000..bf580a54 --- /dev/null +++ b/test/fixtures/stylesheets/relative/config.rb @@ -0,0 +1,9 @@ +# Require any additional compass plugins here. +css_dir = "tmp" +sass_dir = "sass" +images_dir = "assets/images" +javascripts_dir = "assets/javascripts" +# Set this to the root of your project when deployed: +http_path = "/" +# To enable relative paths to assets via compass helper functions. Uncomment: +relative_assets = true diff --git a/test/fixtures/stylesheets/relative/css/ie.css b/test/fixtures/stylesheets/relative/css/ie.css new file mode 100644 index 00000000..6a46809e --- /dev/null +++ b/test/fixtures/stylesheets/relative/css/ie.css @@ -0,0 +1 @@ +/* Welcome to Compass. Use this file to write IE specific override styles. Import this file using the following HTML or equivalent: */ diff --git a/test/fixtures/stylesheets/relative/css/print.css b/test/fixtures/stylesheets/relative/css/print.css new file mode 100644 index 00000000..0a6606ce --- /dev/null +++ b/test/fixtures/stylesheets/relative/css/print.css @@ -0,0 +1 @@ +/* Welcome to Compass. Use this file to define print styles. Import this file using the following HTML or equivalent: */ diff --git a/test/fixtures/stylesheets/relative/css/screen.css b/test/fixtures/stylesheets/relative/css/screen.css new file mode 100644 index 00000000..126d8932 --- /dev/null +++ b/test/fixtures/stylesheets/relative/css/screen.css @@ -0,0 +1 @@ +test { background: url('../assets/images/testing.png?1258702388'); } diff --git a/test/fixtures/stylesheets/relative/sass/ie.sass b/test/fixtures/stylesheets/relative/sass/ie.sass new file mode 100644 index 00000000..b38d08b4 --- /dev/null +++ b/test/fixtures/stylesheets/relative/sass/ie.sass @@ -0,0 +1,6 @@ +/* + Welcome to Compass. Use this file to write IE specific override styles. + Import this file using the following HTML or equivalent: + diff --git a/test/fixtures/stylesheets/relative/sass/print.sass b/test/fixtures/stylesheets/relative/sass/print.sass new file mode 100644 index 00000000..34991cab --- /dev/null +++ b/test/fixtures/stylesheets/relative/sass/print.sass @@ -0,0 +1,6 @@ +/* + Welcome to Compass. Use this file to define print styles. + Import this file using the following HTML or equivalent: + + + diff --git a/test/fixtures/stylesheets/relative/sass/screen.sass b/test/fixtures/stylesheets/relative/sass/screen.sass new file mode 100644 index 00000000..cba1ea72 --- /dev/null +++ b/test/fixtures/stylesheets/relative/sass/screen.sass @@ -0,0 +1,3 @@ + +test + background= image_url("testing.png")