2009-11-23 00:37:11 +01:00
|
|
|
Feature: Relative Assets
|
|
|
|
In order easily switch between relative and absolute paths
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2012-02-01 06:30:45 +01:00
|
|
|
Scenario: Previewing css with the feature disabled
|
2009-11-23 00:37:11 +01:00
|
|
|
Given "relative_assets" feature is "disabled"
|
2011-12-30 04:28:49 +01:00
|
|
|
And the Server is running at "relative-assets-app"
|
2009-11-23 00:37:11 +01:00
|
|
|
When I go to "/stylesheets/relative_assets.css"
|
2010-04-18 21:08:08 +02:00
|
|
|
Then I should not see "url('../"
|
2014-04-07 21:43:16 +02:00
|
|
|
And I should see '/images/blank.gif")'
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2012-02-01 06:30:45 +01:00
|
|
|
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"
|
2014-04-07 21:43:16 +02:00
|
|
|
Then the file "stylesheets/relative_assets.css" should contain 'url("/images/blank.gif")'
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2011-07-24 07:49:32 +02:00
|
|
|
Scenario: Rendering html with the feature disabled
|
|
|
|
Given "relative_assets" feature is "disabled"
|
2011-12-30 04:28:49 +01:00
|
|
|
And the Server is running at "relative-assets-app"
|
2011-07-24 07:49:32 +02:00
|
|
|
When I go to "/relative_image.html"
|
2015-06-22 19:37:17 +02:00
|
|
|
Then I should see '"/stylesheets/relative_assets.css"'
|
|
|
|
Then I should see '"/javascripts/app.js"'
|
|
|
|
Then I should see "/images/blank.gif"
|
|
|
|
When I go to "/absolute_image_relative_css.html"
|
|
|
|
Then I should see '"stylesheets/relative_assets.css"'
|
|
|
|
Then I should see '"javascripts/app.js"'
|
2011-07-24 07:49:32 +02:00
|
|
|
Then I should see "/images/blank.gif"
|
2009-11-23 00:37:11 +01:00
|
|
|
|
|
|
|
Scenario: Rendering css with the feature enabled
|
|
|
|
Given "relative_assets" feature is "enabled"
|
2011-12-30 04:28:49 +01:00
|
|
|
And the Server is running at "relative-assets-app"
|
2009-11-23 00:37:11 +01:00
|
|
|
When I go to "/stylesheets/relative_assets.css"
|
2014-04-07 21:43:16 +02:00
|
|
|
Then I should see 'url("../images/blank.gif'
|
|
|
|
When I go to "/javascripts/application.js"
|
|
|
|
Then I should not see "../"
|
2015-12-13 22:06:05 +01:00
|
|
|
When I go to "/stylesheets/fonts.css"
|
|
|
|
Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot'
|
|
|
|
And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff'
|
|
|
|
And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf'
|
|
|
|
And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg'
|
2015-12-15 18:58:22 +01:00
|
|
|
When I go to "/stylesheets/fonts2.css"
|
|
|
|
Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot'
|
|
|
|
And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff'
|
|
|
|
And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf'
|
|
|
|
And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg'
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2012-02-01 06:30:45 +01:00
|
|
|
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"
|
2014-04-07 21:43:16 +02:00
|
|
|
Then the file "stylesheets/relative_assets.css" should contain 'url("../images/blank.gif")'
|
|
|
|
Then the file "javascripts/application.js" should not contain "../"
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2012-04-17 01:52:21 +02:00
|
|
|
Scenario: Relative css reference with directory indexes
|
|
|
|
Given a fixture app "relative-assets-app"
|
|
|
|
And a file named "config.rb" with:
|
|
|
|
"""
|
|
|
|
activate :directory_indexes
|
|
|
|
activate :relative_assets
|
|
|
|
"""
|
|
|
|
Given a successfully built app at "relative-assets-app"
|
|
|
|
When I cd to "build"
|
|
|
|
Then the file "relative_image/index.html" should contain "../stylesheets/relative_assets.css"
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2015-09-19 23:26:30 +02:00
|
|
|
Scenario: Rendering html with the feature enabled (overrides relative option on helpers)
|
2011-07-24 07:49:32 +02:00
|
|
|
Given "relative_assets" feature is "enabled"
|
2011-12-30 04:28:49 +01:00
|
|
|
And the Server is running at "relative-assets-app"
|
2011-07-24 07:49:32 +02:00
|
|
|
When I go to "/relative_image.html"
|
2015-06-22 19:37:17 +02:00
|
|
|
Then I should see '"stylesheets/relative_assets.css"'
|
|
|
|
Then I should see '"javascripts/app.js"'
|
|
|
|
When I go to "/relative_image_absolute_css.html"
|
2015-09-19 23:26:30 +02:00
|
|
|
Then I should see '"stylesheets/relative_assets.css"'
|
|
|
|
Then I should see '"javascripts/app.js"'
|
2011-07-24 07:49:32 +02:00
|
|
|
Then I should not see "/images/blank.gif"
|
|
|
|
And I should see "images/blank.gif"
|
2013-05-06 03:39:50 +02:00
|
|
|
|
2011-09-20 19:21:38 +02:00
|
|
|
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"
|
2014-04-07 21:43:16 +02:00
|
|
|
Then I should see:
|
|
|
|
"""
|
|
|
|
url("../fonts/StMarie-Thin.otf"
|
|
|
|
"""
|
|
|
|
And I should see:
|
|
|
|
"""
|
|
|
|
url("../fonts/blank/blank.otf"
|
|
|
|
"""
|
2013-05-06 03:39:50 +02:00
|
|
|
|
|
|
|
Scenario: Building scss with the feature enabled
|
|
|
|
Given a fixture app "fonts-app"
|
|
|
|
And a file named "config.rb" with:
|
|
|
|
"""
|
|
|
|
activate :relative_assets
|
|
|
|
"""
|
|
|
|
Given a successfully built app at "fonts-app"
|
|
|
|
When I cd to "build"
|
2014-04-07 21:43:16 +02:00
|
|
|
Then the file "stylesheets/fonts.css" should contain:
|
2013-05-06 03:39:50 +02:00
|
|
|
"""
|
2014-04-07 21:43:16 +02:00
|
|
|
url("../fonts/StMarie-Thin.otf")
|
|
|
|
"""
|
|
|
|
And the file "stylesheets/fonts.css" should contain:
|
|
|
|
"""
|
|
|
|
url("../fonts/blank/blank.otf")
|
2013-05-06 03:39:50 +02:00
|
|
|
"""
|
2012-07-01 07:02:23 +02:00
|
|
|
|
|
|
|
Scenario: Relative assets via image_tag
|
|
|
|
Given a fixture app "relative-assets-app"
|
|
|
|
Given "relative_assets" feature is "enabled"
|
|
|
|
And a file named "source/sub/image_tag.html.erb" with:
|
|
|
|
"""
|
|
|
|
<%= image_tag '/img/blank.gif' %>
|
|
|
|
"""
|
|
|
|
And the Server is running at "relative-assets-app"
|
|
|
|
When I go to "/sub/image_tag.html"
|
2013-05-06 03:39:50 +02:00
|
|
|
Then I should see '<img src="../img/blank.gif" />'
|
2013-06-16 01:22:14 +02:00
|
|
|
|
|
|
|
Scenario: Relative assets should not break data URIs in image_tag
|
|
|
|
Given a fixture app "relative-assets-app"
|
|
|
|
Given "relative_assets" feature is "enabled"
|
|
|
|
And a file named "source/sub/image_tag.html.erb" with:
|
|
|
|
"""
|
|
|
|
<%= image_tag "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" %>
|
|
|
|
"""
|
|
|
|
And the Server is running at "relative-assets-app"
|
|
|
|
When I go to "/sub/image_tag.html"
|
2015-09-19 23:26:30 +02:00
|
|
|
Then I should see '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />'
|