|
32 | 32 | end |
33 | 33 |
|
34 | 34 | it 'returns the same arguments' do |
35 | | - allow(File).to receive(:exists?).with(VALID_FILE).and_return(true) |
| 35 | + allow(File).to receive(:exist?).with(VALID_FILE).and_return(true) |
36 | 36 | expect(validator.validate(args)).to equal(args) |
37 | 37 | end |
38 | 38 | end |
|
93 | 93 | end |
94 | 94 |
|
95 | 95 | it 'throws a ValidationError' do |
96 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 96 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
97 | 97 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
98 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(false) |
99 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec.yaml").and_return(false) |
| 98 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(false) |
| 99 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec.yaml").and_return(false) |
100 | 100 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "Expecting appspec file at location #{FAKE_DIRECTORY}/appspec.yml or #{FAKE_DIRECTORY}/appspec.yaml but it is not found there. Please either run the CLI from within a directory containing the appspec.yml or appspec.yaml file or specify a bundle location containing an appspec.yml or appspec.yaml file in its root directory") |
101 | 101 | end |
102 | 102 | end |
|
109 | 109 | end |
110 | 110 |
|
111 | 111 | it 'throws a ValidationError' do |
112 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 112 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
113 | 113 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
114 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec-override.yaml").and_return(false) |
| 114 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec-override.yaml").and_return(false) |
115 | 115 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "Expecting appspec file at location #{FAKE_DIRECTORY}/appspec-override.yaml but it is not found there. Please either run the CLI from within a directory containing the appspec-override.yaml file or specify a bundle location containing an appspec-override.yaml file in its root directory") |
116 | 116 | end |
117 | 117 | end |
|
129 | 129 | end |
130 | 130 |
|
131 | 131 | it 'throws a ValidationError' do |
132 | | - allow(File).to receive(:exists?).with(FAKE_FILE_WHICH_DOES_NOT_EXIST).and_return(false) |
| 132 | + allow(File).to receive(:exist?).with(FAKE_FILE_WHICH_DOES_NOT_EXIST).and_return(false) |
133 | 133 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "location #{FAKE_FILE_WHICH_DOES_NOT_EXIST} is specified as a file or directory which does not exist") |
134 | 134 | end |
135 | 135 | end |
|
147 | 147 | end |
148 | 148 |
|
149 | 149 | it 'throws a ValidationError' do |
150 | | - allow(File).to receive(:exists?).with(FAKE_FILE).and_return(true) |
| 150 | + allow(File).to receive(:exist?).with(FAKE_FILE).and_return(true) |
151 | 151 | allow(File).to receive(:file?).with(FAKE_FILE).and_return(true) |
152 | 152 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "location #{FAKE_FILE} is specified with type directory but it is a file") |
153 | 153 | end |
|
173 | 173 | end |
174 | 174 |
|
175 | 175 | it 'throws a ValidationError' do |
176 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 176 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
177 | 177 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
178 | 178 | expect{validator.validate(argszip)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "location #{FAKE_DIRECTORY} is specified as a compressed local file but it is a directory") |
179 | 179 | expect{validator.validate(argstgz)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "location #{FAKE_DIRECTORY} is specified as a compressed local file but it is a directory") |
|
189 | 189 | end |
190 | 190 |
|
191 | 191 | it 'throws a ValidationError' do |
192 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 192 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
193 | 193 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
194 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
| 194 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
195 | 195 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "The only events that can be specified before DownloadBundle are BeforeBlockTraffic,AfterBlockTraffic,ApplicationStop. Please fix the order of your specified events: #{args['--events']}") |
196 | 196 | end |
197 | 197 | end |
|
205 | 205 | end |
206 | 206 |
|
207 | 207 | it 'throws a ValidationError' do |
208 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 208 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
209 | 209 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
210 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
| 210 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
211 | 211 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "The only events that can be specified before DownloadBundle are BeforeBlockTraffic,AfterBlockTraffic,ApplicationStop. Please fix the order of your specified events: #{args['--events']}") |
212 | 212 | end |
213 | 213 | end |
|
221 | 221 | end |
222 | 222 |
|
223 | 223 | it 'throws a ValidationError' do |
224 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 224 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
225 | 225 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
226 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
| 226 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
227 | 227 | expect{validator.validate(args)}.to raise_error(AWS::CodeDeploy::Local::CLIValidator::ValidationError, "The only events that can be specified before Install are BeforeBlockTraffic,AfterBlockTraffic,ApplicationStop,DownloadBundle,BeforeInstall. Please fix the order of your specified events: #{args['--events']}") |
228 | 228 | end |
229 | 229 | end |
|
237 | 237 | end |
238 | 238 |
|
239 | 239 | it 'returns the same arguments' do |
240 | | - allow(File).to receive(:exists?).with(FAKE_DIRECTORY).and_return(true) |
| 240 | + allow(File).to receive(:exist?).with(FAKE_DIRECTORY).and_return(true) |
241 | 241 | allow(File).to receive(:directory?).with(FAKE_DIRECTORY).and_return(true) |
242 | | - expect(File).to receive(:exists?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
| 242 | + expect(File).to receive(:exist?).with("#{FAKE_DIRECTORY}/appspec.yml").and_return(true) |
243 | 243 | expect(validator.validate(args)).to equal(args) |
244 | 244 | end |
245 | 245 | end |
|
0 commit comments