add failing tests for compass relative assets
This commit is contained in:
parent
599ea94f5e
commit
251a2e0eb3
|
@ -31,6 +31,10 @@ module Middleman::Cli
|
|||
:aliases => "-g",
|
||||
:default => nil,
|
||||
:desc => 'Build a subset of the project'
|
||||
method_option :verbose,
|
||||
:type => :boolean,
|
||||
:default => false,
|
||||
:desc => 'Print debug messages'
|
||||
|
||||
# Core build Thor command
|
||||
# @return [void]
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
Feature: Relative Assets
|
||||
In order easily switch between relative and absolute paths
|
||||
|
||||
Scenario: Rendering css with the feature disabled
|
||||
Scenario: Previewing css with the feature disabled
|
||||
Given "relative_assets" feature is "disabled"
|
||||
And the Server is running at "relative-assets-app"
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should not see "url('../"
|
||||
And I should see "/images/blank.gif"
|
||||
And I should see "url('/images/blank.gif')"
|
||||
|
||||
Scenario: Building css with the feature disabled
|
||||
Given a fixture app "relative-assets-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
"""
|
||||
Given a successfully built app at "relative-assets-app"
|
||||
When I cd to "build"
|
||||
Then the file "stylesheets/relative_assets.css" should contain "url('/images/blank.gif')"
|
||||
|
||||
Scenario: Rendering html with the feature disabled
|
||||
Given "relative_assets" feature is "disabled"
|
||||
|
@ -20,6 +29,16 @@ Feature: Relative Assets
|
|||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should see "url('../images/blank.gif"
|
||||
|
||||
Scenario: Building css with the feature enabled
|
||||
Given a fixture app "relative-assets-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
activate :relative_assets
|
||||
"""
|
||||
Given a successfully built app at "relative-assets-app"
|
||||
When I cd to "build"
|
||||
Then the file "stylesheets/relative_assets.css" should contain "url('../images/blank.gif')"
|
||||
|
||||
Scenario: Rendering html with the feature enabled
|
||||
Given "relative_assets" feature is "enabled"
|
||||
And the Server is running at "relative-assets-app"
|
||||
|
@ -28,13 +47,24 @@ Feature: Relative Assets
|
|||
And I should see "images/blank.gif"
|
||||
|
||||
Scenario: Rendering html with a custom images_dir
|
||||
Given "relative_assets" feature is "enabled"
|
||||
Given "css" feature is "enabled"
|
||||
And "images_dir" is set to "img"
|
||||
And the Server is running at "relative-assets-app"
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should see "url('../img/blank.gif"
|
||||
Then I should see "url('../img/blank.gif')"
|
||||
|
||||
Scenario: Rendering css with a custom images_dir
|
||||
Scenario: Building css with a custom images_dir
|
||||
Given a fixture app "relative-assets-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
set :images_dir, "img"
|
||||
activate :relative_assets
|
||||
"""
|
||||
Given a successfully built app at "relative-assets-app"
|
||||
When I cd to "build"
|
||||
Then the file "stylesheets/relative_assets.css" should contain "url('../img/blank.gif')"
|
||||
|
||||
Scenario: Rendering html with a custom images_dir
|
||||
Given "relative_assets" feature is "enabled"
|
||||
And "images_dir" is set to "img"
|
||||
And the Server is running at "relative-assets-app"
|
||||
|
@ -43,8 +73,9 @@ Feature: Relative Assets
|
|||
Then I should not see "/img/blank.gif"
|
||||
And I should see "img/blank.gif"
|
||||
|
||||
|
||||
Scenario: Rendering scss with the feature enabled
|
||||
Given "relative_assets" feature is "enabled"
|
||||
And the Server is running at "fonts-app"
|
||||
When I go to "/stylesheets/fonts.css"
|
||||
Then I should see "url('../fonts/StMarie"
|
||||
Then I should see "url('../fonts/StMarie-Thin.otf"
|
|
@ -0,0 +1 @@
|
|||
activate :relative_assets
|
|
@ -58,14 +58,14 @@ module Middleman::CoreExtensions::Compass
|
|||
end
|
||||
|
||||
# Change paths when in build mode. Required for relative paths
|
||||
configure :build do
|
||||
::Compass.configuration do |config|
|
||||
config.environment = :production
|
||||
config.css_dir = File.join(build_dir, css_dir)
|
||||
config.images_dir = File.join(build_dir, images_dir)
|
||||
config.fonts_dir = File.join(build_dir, fonts_dir)
|
||||
end
|
||||
end
|
||||
# configure :build do
|
||||
# ::Compass.configuration do |config|
|
||||
# config.environment = :production
|
||||
# config.css_dir = File.join(build_dir, css_dir)
|
||||
# config.images_dir = File.join(build_dir, images_dir)
|
||||
# config.fonts_dir = File.join(build_dir, fonts_dir)
|
||||
# end
|
||||
# end
|
||||
|
||||
run_hook :compass_config, ::Compass.configuration
|
||||
run_hook :after_compass_config
|
||||
|
|
|
@ -70,5 +70,5 @@ module Middleman::Extensions
|
|||
end
|
||||
|
||||
# Register the extension
|
||||
register :cache_buster, CacheBuster
|
||||
# register :cache_buster, CacheBuster
|
||||
end
|
|
@ -22,5 +22,5 @@ module Middleman::Extensions
|
|||
end
|
||||
|
||||
# Register extension
|
||||
register :minify_css, MinifyCss
|
||||
# register :minify_css, MinifyCss
|
||||
end
|
|
@ -73,5 +73,5 @@ module Middleman::Extensions
|
|||
end
|
||||
|
||||
# Register extension
|
||||
register :minify_javascript, MinifyJavascript
|
||||
# register :minify_javascript, MinifyJavascript
|
||||
end
|
|
@ -58,5 +58,5 @@ module Middleman::Extensions
|
|||
end
|
||||
|
||||
# Register extension
|
||||
register :relative_assets, RelativeAssets
|
||||
# register :relative_assets, RelativeAssets
|
||||
end
|
|
@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency("uglifier", ["~> 1.2.0"])
|
||||
s.add_dependency("haml", ["~> 3.1.0"])
|
||||
s.add_dependency("sass", ["~> 3.1.7"])
|
||||
s.add_dependency("compass", ["~> 0.11.3"])
|
||||
s.add_dependency("compass", ["0.12.rc.0"])
|
||||
s.add_dependency("coffee-script", ["~> 2.2.0"])
|
||||
s.add_dependency("execjs", ["~> 1.2.7"])
|
||||
s.add_dependency("sprockets", ["~> 2.1.0"])
|
||||
|
|
Loading…
Reference in a new issue