-
Notifications
You must be signed in to change notification settings - Fork 53
/
basic_usage.feature
97 lines (81 loc) · 2.8 KB
/
basic_usage.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Feature: Basic Usage
At it's base, the middleman-sprockets extension hooks sprockets into Middleman so that Sprockets is used to render js & css files instead of Middleman. This gives you access to [sprockets directives](https://github.com/rails/sprockets#sprockets-directives) and automagically building linked assets.
To use, activate the extension in `config.rb`:
"""ruby
activate :sprockets
"""
Scenario: CSS & JS files are rendered with Sprockets
Given a fixture app "base-app"
And a file named "config.rb" with:
"""
activate :sprockets
"""
And a file named "source/stylesheets/_lib/partial.scss" with:
"""
body { background: #fd0; }
"""
And a file named "source/stylesheets/site.css.scss" with:
"""
@import '_lib/partial';
"""
And a file named "source/javascripts/_lib/partial.js" with:
"""
console.log('hello');
"""
And a file named "source/javascripts/site.js" with:
"""
//= require '_lib/partial'
"""
And the Server is running
When I go to "/stylesheets/site.css"
Then I should see:
"""
body {
background: #fd0; }
"""
When I go to "/javascripts/site.js"
Then I should see "console.log('hello');"
Scenario: The default :css_dir or :js_dir are appended to Sprockets lookup paths
Given a fixture app "base-app"
And a file named "config.rb" with:
"""
activate :sprockets
"""
And the Server is running
Then sprockets paths should include "source/stylesheets"
And sprockets paths should include "source/javascripts"
Scenario: Custom directories for :css_dir or :js_dir are appened to Sprockets lookup paths
Given a fixture app "base-app"
And a file named "config.rb" with:
"""
activate :sprockets
set :css_dir, "assets/css"
set :js_dir, "assets/scripts"
"""
And the Server is running
Then sprockets paths should include "source/assets/css"
And sprockets paths should include "source/assets/scripts"
@sprockets3
Scenario: Css can use either a Sprockets require or Sass import
Given a fixture app "base-app"
And a file named "config.rb" with:
"""
activate :sprockets
"""
And a file named "source/stylesheets/_lib/import.scss" with:
"""
body { content: 'imported'; }
"""
And a file named "source/stylesheets/sprockets.css.scss" with:
"""
//= require '_lib/import.css'
"""
And a file named "source/stylesheets/sass_import.css.scss" with:
"""
@import '_lib/import';
"""
And the Server is running
When I go to "/stylesheets/sprockets.css"
Then I should see "content: 'imported';"
When I go to "/stylesheets/sass_import.css"
Then I should see "content: 'imported';"