2011-12-29 22:04:39 -05:00
|
|
|
Feature: Alternate between multiple asset hosts
|
|
|
|
In order to speed up page loading
|
2013-04-20 15:59:14 -04:00
|
|
|
|
|
|
|
Scenario: Set single host globally
|
|
|
|
Given a fixture app "asset-host-app"
|
|
|
|
And a file named "config.rb" with:
|
|
|
|
"""
|
2014-04-07 15:43:16 -04:00
|
|
|
activate :asset_host, host: "http://assets1.example.com"
|
2013-04-20 15:59:14 -04:00
|
|
|
"""
|
|
|
|
And the Server is running
|
2011-12-29 22:04:39 -05:00
|
|
|
When I go to "/asset_host.html"
|
2013-04-20 15:59:14 -04:00
|
|
|
Then I should see "http://assets1"
|
|
|
|
When I go to "/stylesheets/asset_host.css"
|
|
|
|
Then I should see "http://assets1"
|
|
|
|
|
|
|
|
Scenario: Set single host with inline-option
|
|
|
|
Given a fixture app "asset-host-app"
|
|
|
|
And a file named "config.rb" with:
|
|
|
|
"""
|
2014-05-26 20:58:35 -04:00
|
|
|
activate :asset_host, host: "http://assets1.example.com"
|
2013-04-20 15:59:14 -04:00
|
|
|
"""
|
|
|
|
And the Server is running
|
|
|
|
When I go to "/asset_host.html"
|
2014-04-07 15:43:16 -04:00
|
|
|
Then I should see content matching %r{http://assets1.example.com/}
|
|
|
|
Then I should not see content matching %r{http://assets1.example.com//}
|
2013-04-20 15:59:14 -04:00
|
|
|
When I go to "/stylesheets/asset_host.css"
|
2014-04-07 15:43:16 -04:00
|
|
|
Then I should see content matching %r{http://assets1.example.com/}
|
|
|
|
Then I should not see content matching %r{http://assets1.example.com//}
|
2013-04-20 15:59:14 -04:00
|
|
|
|
|
|
|
Scenario: Set proc host with inline-option
|
|
|
|
Given a fixture app "asset-host-app"
|
|
|
|
And a file named "config.rb" with:
|
|
|
|
"""
|
2014-05-26 20:58:35 -04:00
|
|
|
activate :asset_host, host: Proc.new { |asset|
|
2013-04-20 15:59:14 -04:00
|
|
|
"http://assets%d.example.com" % (asset.hash % 4)
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
And the Server is running
|
|
|
|
When I go to "/asset_host.html"
|
2014-04-07 15:43:16 -04:00
|
|
|
Then I should see content matching %r{http://assets1.example.com/}
|
|
|
|
Then I should not see content matching %r{http://assets1.example.com//}
|
2013-04-20 15:59:14 -04:00
|
|
|
When I go to "/stylesheets/asset_host.css"
|
2014-04-07 15:43:16 -04:00
|
|
|
Then I should see content matching %r{http://assets1.example.com/}
|
|
|
|
Then I should not see content matching %r{http://assets1.example.com//}
|