add tests for relative custom image paths. fixes #59
This commit is contained in:
parent
527fa3160f
commit
5c2defac6d
7 changed files with 57 additions and 26 deletions
|
@ -3,10 +3,42 @@ Feature: Relative Assets
|
|||
|
||||
Scenario: Rendering css with the feature disabled
|
||||
Given "relative_assets" feature is "disabled"
|
||||
And the Server is running
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should not see "url('../"
|
||||
And I should see "url('/images/blank.gif"
|
||||
|
||||
Scenario: Rendering html with the feature disabled
|
||||
Given "relative_assets" feature is "disabled"
|
||||
And the Server is running
|
||||
When I go to "/relative_image.html"
|
||||
Then I should see "/images/blank.gif"
|
||||
|
||||
Scenario: Rendering css with the feature enabled
|
||||
Given "relative_assets" feature is "enabled"
|
||||
And the Server is running
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should see "url('../"
|
||||
Then I should see "url('../images/blank.gif"
|
||||
|
||||
Scenario: Rendering html with the feature disabled
|
||||
Given "relative_assets" feature is "enabled"
|
||||
And the Server is running
|
||||
When I go to "/relative_image.html"
|
||||
Then I should not see "/images/blank.gif"
|
||||
And I should see "images/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
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should see "url('../img/blank.gif"
|
||||
|
||||
Scenario: Rendering css with a custom images_dir
|
||||
Given "relative_assets" feature is "enabled"
|
||||
And "images_dir" is set to "img"
|
||||
And the Server is running
|
||||
When I go to "/relative_image.html"
|
||||
Then I should not see "/images/blank.gif"
|
||||
Then I should not see "/img/blank.gif"
|
||||
And I should see "img/blank.gif"
|
|
@ -1,9 +1,7 @@
|
|||
Given /^I am using an asset host$/ do
|
||||
sandbox_server = Middleman.server do
|
||||
activate :asset_host
|
||||
set :asset_host do |asset|
|
||||
"http://assets%d.example.com" % (asset.hash % 4)
|
||||
end
|
||||
@server ||= Middleman.server
|
||||
@server.activate :asset_host
|
||||
@server.set :asset_host do |asset|
|
||||
"http://assets%d.example.com" % (asset.hash % 4)
|
||||
end
|
||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
||||
end
|
|
@ -1,11 +1,14 @@
|
|||
Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
|
||||
sandbox_server = Middleman.server do
|
||||
if state == "enabled"
|
||||
activate(feature.to_sym)
|
||||
end
|
||||
set :environment, @current_env || :development
|
||||
@server ||= Middleman.server
|
||||
if state == "enabled"
|
||||
@server.activate(feature.to_sym)
|
||||
end
|
||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
||||
@server.set :environment, @current_env || :development
|
||||
end
|
||||
|
||||
Given /^"([^\"]*)" is set to "([^\"]*)"$/ do |variable, value|
|
||||
@server ||= Middleman.server
|
||||
@server.set variable.to_sym, value
|
||||
end
|
||||
|
||||
Given /^current environment is "([^\"]*)"$/ do |env|
|
||||
|
@ -13,8 +16,8 @@ Given /^current environment is "([^\"]*)"$/ do |env|
|
|||
end
|
||||
|
||||
Given /^the Server is running$/ do
|
||||
sandbox_server = Middleman.server
|
||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
||||
@server ||= Middleman.server
|
||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(@server.new))
|
||||
end
|
||||
|
||||
When /^I go to "([^\"]*)"$/ do |url|
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
|
||||
sandbox_server = Middleman.server do
|
||||
set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
||||
page(url, :layout => layout.to_sym)
|
||||
end
|
||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
||||
@server ||= Middleman.server
|
||||
@server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
||||
@server.page(url, :layout => layout.to_sym)
|
||||
end
|
||||
|
||||
Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout|
|
||||
sandbox_server = Middleman.server do
|
||||
set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
||||
with_layout(layout.to_sym) do
|
||||
page(url)
|
||||
end
|
||||
@server ||= Middleman.server
|
||||
@server.set :root, File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "fixtures", "test-app")
|
||||
@server.with_layout(layout.to_sym) do
|
||||
page(url)
|
||||
end
|
||||
@browser = Rack::Test::Session.new(Rack::MockSession.new(sandbox_server.new))
|
||||
end
|
|
@ -7,6 +7,7 @@ page "/fake.html", :proxy => "/real.html", :layout => false
|
|||
end
|
||||
|
||||
with_layout false do
|
||||
page "/relative_image.html"
|
||||
page "/inline-css.html"
|
||||
page "/inline-js.html"
|
||||
page "/inline-coffeescript.html"
|
||||
|
|
BIN
fixtures/test-app/source/img/blank.gif
Executable file
BIN
fixtures/test-app/source/img/blank.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 43 B |
1
fixtures/test-app/source/relative_image.html.erb
Normal file
1
fixtures/test-app/source/relative_image.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= image_tag "blank.gif" %>
|
Loading…
Reference in a new issue