File tree Expand file tree Collapse file tree 1 file changed +28
-14
lines changed
spec/lib/critical_path_css Expand file tree Collapse file tree 1 file changed +28
-14
lines changed Original file line number Diff line number Diff line change 1
1
require 'spec_helper'
2
2
3
3
RSpec . describe 'CssFetcher' do
4
- describe '#fetch' do
5
- let ( :subject ) { CriticalPathCss ::CssFetcher . new ( config ) }
6
- let ( :response ) {
7
- [ 'foo' , '' , OpenStruct . new ( exitstatus : 0 ) ]
8
- }
9
- let ( :routes ) { [ '/' , '/new_route' ] }
10
- let ( :config ) do
11
- OpenStruct . new (
12
- base_url : 'http://0.0.0.0:9292' ,
13
- css_path : css_path ,
14
- css_paths : css_paths ,
15
- penthouse_options : { } ,
16
- routes : routes
17
- )
4
+ let ( :subject ) { CriticalPathCss ::CssFetcher . new ( config ) }
5
+ let ( :response ) { [ 'foo' , '' , OpenStruct . new ( exitstatus : 0 ) ] }
6
+ let ( :routes ) { [ '/' , '/new_route' ] }
7
+ let ( :config ) do
8
+ OpenStruct . new (
9
+ base_url : 'http://0.0.0.0:9292' ,
10
+ css_path : css_path ,
11
+ css_paths : css_paths ,
12
+ penthouse_options : { } ,
13
+ routes : routes
14
+ )
15
+ end
16
+
17
+ describe '#fetch_route' do
18
+ context 'when a single css_path is configured' do
19
+ let ( :css_path ) { '/test.css' }
20
+ let ( :css_paths ) { [ ] }
21
+
22
+ it 'generates css for the single route' do
23
+ expect ( Open3 ) . to receive ( :capture3 ) do |arg1 , arg2 , arg3 |
24
+ options = JSON . parse ( arg3 )
25
+ expect ( options [ 'css' ] ) . to eq '/test.css'
26
+ end . once . and_return ( response )
27
+
28
+ subject . fetch_route ( routes . first )
29
+ end
18
30
end
31
+ end
19
32
33
+ describe '#fetch' do
20
34
context 'when a single css_path is configured' do
21
35
let ( :css_path ) { '/test.css' }
22
36
let ( :css_paths ) { [ ] }
You can’t perform that action at this time.
0 commit comments