-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa40be6
commit 2a5f8d4
Showing
7 changed files
with
178 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Postnord::Base do | ||
describe '.mandatory_params' do | ||
it 'raises not implemented error' do | ||
expect { | ||
described_class.send(:mandatory_params) | ||
}.to raise_error(NotImplementedError, 'mandatory_params') | ||
end | ||
end | ||
|
||
describe '.endpoint' do | ||
it 'raises not implemented error' do | ||
expect { | ||
described_class.send(:endpoint) | ||
}.to raise_error(NotImplementedError, 'endpoint') | ||
end | ||
end | ||
|
||
describe '.validate_params' do | ||
before do | ||
expect(described_class).to receive(:mandatory_params).and_return(['param1', 'param2']) | ||
end | ||
|
||
context 'with missing param' do | ||
it 'raises missing mandatory parameters error' do | ||
expect { | ||
described_class.send(:validate_params, { param1: 'test' }) | ||
}.to raise_error(Postnord::Base::MissingMandatoryParameters, /param2/) | ||
end | ||
end | ||
|
||
context 'without missing param' do | ||
it 'does not raise any error' do | ||
expect { | ||
described_class.send(:validate_params, { param1: 'test', param2: 'test' }) | ||
}.not_to raise_error(Postnord::Base::MissingMandatoryParameters) | ||
end | ||
end | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Postnord::BusinessLocation do | ||
describe '.service' do | ||
it 'uses correct service' do | ||
expect(described_class.service).to eq 'businesslocation' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::FindNearestByCoordinates do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'servicepoint/findNearestByCoordinates' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::FindByPostalCode do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'servicepoint/findByPostalCode' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::FindNearestByAddress do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'servicepoint/findNearestByAddress' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::GetServicePointInformation do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'servicepoint/getServicePointInformation' | ||
end | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Postnord::Shipment do | ||
describe '.service' do | ||
it 'uses correct service' do | ||
expect(described_class.service).to eq 'shipment' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::FindByIdentifier do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'trackandtrace/findByIdentifier' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::FindByNotificationCode do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'trackandtrace/findByNotificationCode' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::FindByReference do | ||
describe '.endpoint' do | ||
it 'calls correct endpoint' do | ||
expect(described_class.endpoint).to eq 'trackandtrace/findByReference' | ||
end | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Postnord::Transport do | ||
describe '.service' do | ||
it 'uses correct service' do | ||
expect(described_class.service).to eq 'transport' | ||
end | ||
end | ||
end | ||
|
||
RSpec.describe Postnord::GetTransitTimeInformation do | ||
describe '.endpoint' do | ||
it 'calls endpoint' do | ||
expect(described_class.endpoint).to eq 'transittime/getTransitTimeInformation' | ||
end | ||
end | ||
end |
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