File tree Expand file tree Collapse file tree 3 files changed +12
-19
lines changed
spec/lib/critical_path_css Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -24,5 +24,9 @@ def routes
24
24
def penthouse_options
25
25
@config [ 'penthouse_options' ] || { }
26
26
end
27
+
28
+ def path_for_route ( route )
29
+ css_paths [ routes . index ( route ) ] || css_paths . first
30
+ end
27
31
end
28
32
end
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ def fetch
16
16
def fetch_route ( route )
17
17
options = {
18
18
'url' => @config . base_url + route ,
19
- 'css' => fetch_css_path_for_route ( route ) ,
19
+ 'css' => @config . path_for_route ( route ) ,
20
20
'width' => 1300 ,
21
21
'height' => 900 ,
22
22
'timeout' => 30_000 ,
@@ -51,17 +51,5 @@ def fetch_route(route)
51
51
end
52
52
out
53
53
end
54
-
55
- private
56
-
57
- def fetch_css_path_for_route ( route )
58
- index_for_route = @config . routes . index ( route )
59
-
60
- if index_for_route && @config . css_paths [ index_for_route ]
61
- @config . css_paths [ index_for_route ]
62
- else
63
- @config . css_path
64
- end
65
- end
66
54
end
67
55
end
Original file line number Diff line number Diff line change 7
7
let ( :response ) { [ 'foo' , '' , OpenStruct . new ( exitstatus : 0 ) ] }
8
8
let ( :routes ) { [ '/' , '/new_route' ] }
9
9
let ( :config ) do
10
- OpenStruct . new (
11
- base_url : base_url ,
12
- css_path : css_path ,
13
- css_paths : css_paths ,
14
- penthouse_options : { } ,
15
- routes : routes
10
+ CriticalPathCss ::Configuration . new (
11
+ OpenStruct . new (
12
+ base_url : base_url ,
13
+ css_paths : css_paths ,
14
+ penthouse_options : { } ,
15
+ routes : routes
16
+ )
16
17
)
17
18
end
18
19
You can’t perform that action at this time.
0 commit comments