2012-01-23 16:58:20 +00:00
|
|
|
Feature: Process files with Sprockets
|
2012-01-23 17:21:11 +00:00
|
|
|
Background:
|
2012-01-23 16:58:20 +00:00
|
|
|
Given I have the file "dir/file.js" with the content:
|
|
|
|
"""
|
|
|
|
//= require other
|
|
|
|
a file
|
|
|
|
"""
|
|
|
|
And I have the file "dir/other.js" with the content:
|
|
|
|
"""
|
|
|
|
another file
|
|
|
|
"""
|
2012-01-23 17:21:11 +00:00
|
|
|
|
|
|
|
Scenario: Simple Sprockets work
|
|
|
|
When I instantiate a Sprockets handler with the following asset directories:
|
|
|
|
| dir |
|
|
|
|
And I work with the Sprockets asset "file"
|
|
|
|
Then the handler should have the following files in order:
|
|
|
|
| dir/other.js |
|
|
|
|
| dir/file.js |
|
|
|
|
|
|
|
|
Scenario: Require the file twice
|
|
|
|
Given I have the file "dir/third.js" with the content:
|
|
|
|
"""
|
|
|
|
//= require other
|
|
|
|
third file
|
|
|
|
"""
|
2012-01-23 16:58:20 +00:00
|
|
|
When I instantiate a Sprockets handler with the following asset directories:
|
|
|
|
| dir |
|
|
|
|
And I work with the Sprockets asset "file"
|
2012-01-23 17:21:11 +00:00
|
|
|
And I work with the Sprockets asset "third"
|
2012-01-23 16:58:20 +00:00
|
|
|
Then the handler should have the following files in order:
|
|
|
|
| dir/other.js |
|
|
|
|
| dir/file.js |
|
2012-01-23 17:21:11 +00:00
|
|
|
| dir/third.js |
|
2012-01-23 16:58:20 +00:00
|
|
|
|
2012-02-08 17:41:18 +00:00
|
|
|
Scenario: Other File Sources
|
2012-01-30 16:34:57 +00:00
|
|
|
Given I have the file "dir/third.js.coffee" with the content:
|
|
|
|
"""
|
|
|
|
#= require other
|
|
|
|
for file in [ 'files' ]
|
|
|
|
alert(file)
|
|
|
|
"""
|
2012-02-08 17:41:18 +00:00
|
|
|
And I have the file "dir/fourth.jst.ejs" with the content:
|
|
|
|
"""
|
|
|
|
<template><%= data %></template>
|
|
|
|
"""
|
|
|
|
And I have the file "dir/five.css.scss" with the content:
|
|
|
|
"""
|
|
|
|
@mixin cat {
|
|
|
|
background: green;
|
|
|
|
}
|
|
|
|
h1 { @include cat }
|
|
|
|
"""
|
2012-01-30 16:34:57 +00:00
|
|
|
When I instantiate a Sprockets handler with the following asset directories:
|
|
|
|
| dir |
|
|
|
|
And I work with the Sprockets asset "third"
|
2012-02-08 17:41:18 +00:00
|
|
|
And I work with the Sprockets asset "fourth"
|
|
|
|
And I work with the Sprockets asset "five"
|
2012-01-30 16:34:57 +00:00
|
|
|
Then the handler should have the following files in order:
|
|
|
|
| dir/other.js |
|
|
|
|
| <%= temp_path_for("dir/third.js.coffee") %> |
|
2012-02-08 17:41:18 +00:00
|
|
|
| <%= temp_path_for("dir/fourth.jst.ejs") %> |
|
|
|
|
| <%= temp_path_for("dir/five.css.scss") %> |
|
2012-01-30 16:34:57 +00:00
|
|
|
And there should be a temp file for the local path "dir/third.js.coffee"
|
2012-02-08 17:41:18 +00:00
|
|
|
And there should be a temp file for the local path "dir/fourth.jst.ejs"
|
|
|
|
And there should be a temp file for the local path "dir/five.css.scss"
|
|
|
|
|