Logo: Relish

  1. Sign in

Project: Pannier v0.2.0

Serving assets

In order that I can use my assets
As a developer
I want to a Rack server that can serve assets

Background
Given
this code has executed
require 'pannier/mounted'
And
the file "input/styles/foo.css" contains
html { color: red; }
And
the file "input/scripts/bar.js" contains
var a = 1;
Scenarios
Requesting a CSS file in production
Given
the file ".assets.rb" contains
input  'input'
output 'output'

package :styles do
  input  'styles'
  assets '*.css'
end
And
the app is loaded in a production environment
And
the app has been processed
When
I request "/foo.css"
Then
the response status should be 200
And
I should see these headers
Content-Type text/css
Content-Length 20
And
the response body should be
html { color: red; }
Requesting a JavaScript file in production
Given
the file ".assets.rb" contains
input  'input'
output 'output'

package :scripts do
  input  'scripts'
  assets '*.js'
end
And
the app is loaded in a production environment
And
the app has been processed
When
I request "/bar.js"
Then
the response status should be 200
And
I should see these headers
Content-Type application/javascript
Content-Length 10
And
the response body should be
var a = 1;

Last published almost 4 years ago by joecorcoran.