Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename ErrorHandler#inspect to ErrorHandler#examine in order not to b…
…reak LSP
- Loading branch information
Showing
4 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
require 'spec_helper' | ||
|
||
describe Minfraud::ErrorHandler do | ||
describe '.inspect' do | ||
describe '.examine' do | ||
let(:response) { Object.new } | ||
|
||
it 'returns a response if status is 200' do | ||
allow(response).to receive(:status) { 200 } | ||
expect(described_class.inspect(response)).to eq response | ||
expect(described_class.examine(response)).to eq response | ||
end | ||
|
||
it 'raises an error if status is not 200 and code is matched' do | ||
allow(response).to receive(:status) { 400 } | ||
allow(response).to receive(:code) { :IP_ADDRESS_INVALID } | ||
|
||
expect { described_class.inspect(response) }.to raise_error(Minfraud::ClientError) | ||
expect { described_class.examine(response) }.to raise_error(Minfraud::ClientError) | ||
end | ||
|
||
it 'raises ServerError if code is not matched' do | ||
allow(response).to receive(:code) { :DUMMY } | ||
allow(response).to receive(:status) { 503 } | ||
|
||
expect { described_class.inspect(response) }.to raise_error(Minfraud::ServerError) | ||
expect { described_class.examine(response) }.to raise_error(Minfraud::ServerError) | ||
end | ||
end | ||
end |