File tree 3 files changed +6
-18
lines changed
spec/lib/critical_path_css/rails
3 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,10 @@ def self.fetch(route)
28
28
end
29
29
30
30
def self . fetcher
31
- @fetcher ||= CssFetcher . new ( Configuration . new ( config ) )
31
+ @fetcher ||= CssFetcher . new ( Configuration . new ( config_loader . config ) )
32
32
end
33
33
34
- def self . config
35
- @config ||= begin
36
- loader = CriticalPathCss ::Rails ::ConfigLoader . new
37
- loader . load
38
- loader . config
39
- end
34
+ def self . config_loader
35
+ @config_loader ||= CriticalPathCss ::Rails ::ConfigLoader . new
40
36
end
41
37
end
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module Rails
3
3
class ConfigLoader
4
4
CONFIGURATION_FILENAME = 'critical_path_css.yml' . freeze
5
5
6
- def load
6
+ def initialize
7
7
validate_css_paths
8
8
format_css_paths
9
9
end
Original file line number Diff line number Diff line change 25
25
CONFIG
26
26
}
27
27
28
- before do
29
- subject . load
30
- end
31
-
32
28
it 'sets css_path with the path' do
33
29
expect ( subject . config [ 'css_path' ] ) . to eq '/app/spec/internal/public/test.css'
34
30
end
58
54
CONFIG
59
55
}
60
56
61
- before do
62
- subject . load
63
- end
64
-
65
57
it 'sets css_path to empty string' do
66
58
expect ( subject . config [ 'css_path' ] ) . to eq ''
67
59
end
93
85
}
94
86
95
87
it 'raises an error' do
96
- expect { subject . load } . to raise_error LoadError , 'Cannot specify both css_path and css_paths'
88
+ expect { subject } . to raise_error LoadError , 'Cannot specify both css_path and css_paths'
97
89
end
98
90
end
99
91
119
111
}
120
112
121
113
it 'raises an error' do
122
- expect { subject . load } . to raise_error LoadError , 'Must specify css_paths for each route'
114
+ expect { subject } . to raise_error LoadError , 'Must specify css_paths for each route'
123
115
end
124
116
end
125
117
end
You can’t perform that action at this time.
0 commit comments