|
3 | 3 | require_relative '../../spec_helper' |
4 | 4 |
|
5 | 5 | require OctocatalogDiff::Spec.require_path('/api/v1/config') |
| 6 | +require OctocatalogDiff::Spec.require_path('/errors') |
6 | 7 |
|
7 | 8 | describe OctocatalogDiff::API::V1::Config do |
8 | 9 | before(:each) do |
|
28 | 29 | expect(File).to receive(:'file?').with(filename).and_return(false) |
29 | 30 | expect do |
30 | 31 | described_class.config(logger: @logger, filename: filename, test: true) |
31 | | - end.to raise_error(OctocatalogDiff::API::V1::Config::ConfigurationFileNotFoundError, pattern) |
| 32 | + end.to raise_error(OctocatalogDiff::Errors::ConfigurationFileNotFoundError, pattern) |
32 | 33 | end |
33 | 34 | end |
34 | 35 |
|
|
159 | 160 | pattern = Regexp.new('must define OctocatalogDiff::Config.config!') |
160 | 161 | expect do |
161 | 162 | described_class.load_config_file(filename, @logger) |
162 | | - end.to raise_error(OctocatalogDiff::API::V1::Config::ConfigurationFileContentError, pattern) |
| 163 | + end.to raise_error(OctocatalogDiff::Errors::ConfigurationFileContentError, pattern) |
163 | 164 | end |
164 | 165 |
|
165 | 166 | it 'should log fatal message' do |
166 | 167 | exception = nil |
167 | 168 | begin |
168 | 169 | described_class.load_config_file(filename, @logger) |
169 | | - rescue OctocatalogDiff::API::V1::Config::ConfigurationFileContentError => exc |
| 170 | + rescue OctocatalogDiff::Errors::ConfigurationFileContentError => exc |
170 | 171 | exception = exc |
171 | 172 | end |
172 | | - expect(exception).to be_a_kind_of(OctocatalogDiff::API::V1::Config::ConfigurationFileContentError) |
| 173 | + expect(exception).to be_a_kind_of(OctocatalogDiff::Errors::ConfigurationFileContentError) |
173 | 174 | expect(exception.message).to eq('Configuration must define OctocatalogDiff::Config.config!') |
174 | 175 | expect(@logger_str.string).to match(/Configuration must define OctocatalogDiff::Config.config!/) |
175 | 176 | end |
|
182 | 183 | pattern = Regexp.new('must define OctocatalogDiff::Config!') |
183 | 184 | expect do |
184 | 185 | described_class.load_config_file(filename, @logger) |
185 | | - end.to raise_error(OctocatalogDiff::API::V1::Config::ConfigurationFileContentError, pattern) |
| 186 | + end.to raise_error(OctocatalogDiff::Errors::ConfigurationFileContentError, pattern) |
186 | 187 | end |
187 | 188 |
|
188 | 189 | it 'should log fatal message' do |
189 | 190 | exception = nil |
190 | 191 | begin |
191 | 192 | described_class.load_config_file(filename, @logger) |
192 | | - rescue OctocatalogDiff::API::V1::Config::ConfigurationFileContentError => exc |
| 193 | + rescue OctocatalogDiff::Errors::ConfigurationFileContentError => exc |
193 | 194 | exception = exc |
194 | 195 | end |
195 | | - expect(exception).to be_a_kind_of(OctocatalogDiff::API::V1::Config::ConfigurationFileContentError) |
| 196 | + expect(exception).to be_a_kind_of(OctocatalogDiff::Errors::ConfigurationFileContentError) |
196 | 197 | expect(exception.message).to eq('Configuration must define OctocatalogDiff::Config!') |
197 | 198 | expect(@logger_str.string).to match(/Configuration must define OctocatalogDiff::Config!/) |
198 | 199 | end |
|
205 | 206 | pattern = Regexp.new('Configuration must be Hash not Array!') |
206 | 207 | expect do |
207 | 208 | described_class.load_config_file(filename, @logger) |
208 | | - end.to raise_error(OctocatalogDiff::API::V1::Config::ConfigurationFileContentError, pattern) |
| 209 | + end.to raise_error(OctocatalogDiff::Errors::ConfigurationFileContentError, pattern) |
209 | 210 | end |
210 | 211 |
|
211 | 212 | it 'should log fatal message' do |
212 | 213 | exception = nil |
213 | 214 | begin |
214 | 215 | described_class.load_config_file(filename, @logger) |
215 | | - rescue OctocatalogDiff::API::V1::Config::ConfigurationFileContentError => exc |
| 216 | + rescue OctocatalogDiff::Errors::ConfigurationFileContentError => exc |
216 | 217 | exception = exc |
217 | 218 | end |
218 | | - expect(exception).to be_a_kind_of(OctocatalogDiff::API::V1::Config::ConfigurationFileContentError) |
| 219 | + expect(exception).to be_a_kind_of(OctocatalogDiff::Errors::ConfigurationFileContentError) |
219 | 220 | expect(exception.message).to eq('Configuration must be Hash not Array!') |
220 | 221 | expect(@logger_str.string).to match(/Configuration must be Hash not Array!/) |
221 | 222 | end |
|
0 commit comments