-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from ioki-mobility/platform-api-task-list-changes
- Loading branch information
Showing
8 changed files
with
167 additions
and
50 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe Ioki::Model::Platform::CalculatedPoint do | ||
describe 'new' do | ||
subject(:task_list) { described_class.new id: '123' } | ||
|
||
it { is_expected.to have_attributes(id: '123') } | ||
it { is_expected.to be_a(described_class) } | ||
end | ||
|
||
describe 'station' do | ||
subject(:task_list) { described_class.new station_id: '123' } | ||
|
||
it { is_expected.to have_attributes station_id: '123' } | ||
it { is_expected.not_to respond_to :station } | ||
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,67 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe Ioki::Model::Platform::TaskList do | ||
describe 'new' do | ||
subject(:task_list) { described_class.new id: '123' } | ||
|
||
it { is_expected.to have_attributes(id: '123') } | ||
it { is_expected.to be_a(described_class) } | ||
end | ||
|
||
describe 'driver' do | ||
subject(:task_list) { described_class.new driver: { id: '123' } } | ||
|
||
it { is_expected.to have_attributes driver: have_attributes(id: '123') } | ||
it { is_expected.to have_attributes driver: be_a(Ioki::Model::Platform::Driver) } | ||
end | ||
|
||
describe 'vehicle' do | ||
subject(:task_list) { described_class.new vehicle: { id: '123', connected_driver_id: '123' } } | ||
|
||
it { is_expected.to have_attributes vehicle: have_attributes(id: '123') } | ||
it { is_expected.to have_attributes vehicle: have_attributes(connected_driver_id: '123') } | ||
it { is_expected.to have_attributes vehicle: be_a(Ioki::Model::Platform::Vehicle) } | ||
end | ||
|
||
describe 'start_place' do | ||
subject(:task_list) { described_class.new start_place: { id: '123' } } | ||
|
||
it { is_expected.to have_attributes start_place: have_attributes(id: '123') } | ||
it { is_expected.to have_attributes start_place: be_a(Ioki::Model::Platform::Place) } | ||
end | ||
|
||
describe 'end_place' do | ||
subject(:task_list) { described_class.new end_place: { id: '123' } } | ||
|
||
it { is_expected.to have_attributes end_place: have_attributes(id: '123') } | ||
it { is_expected.to have_attributes end_place: be_a(Ioki::Model::Platform::Place) } | ||
end | ||
|
||
describe 'matching_configuration' do | ||
subject(:task_list) { described_class.new matching_configuration: nil, matching_configuration_id: '123' } | ||
|
||
it { is_expected.to have_attributes matching_configuration_id: '123' } | ||
it { is_expected.not_to respond_to :matching_configuration } | ||
end | ||
|
||
describe 'tasks' do | ||
subject(:task_list) { described_class.new tasks: [{ id: '123' }] } | ||
|
||
it { is_expected.to have_attributes tasks: all(have_attributes(id: '123')) } | ||
it { is_expected.to have_attributes tasks: all(be_a(Ioki::Model::Platform::Task)) } | ||
end | ||
|
||
describe 'pauses' do | ||
subject(:task_list) { described_class.new pauses: [{ id: '123' }] } | ||
|
||
it { is_expected.to have_attributes pauses: all(have_attributes(id: '123')) } | ||
it { is_expected.to have_attributes pauses: all(be_a(Ioki::Model::Platform::Pause)) } | ||
end | ||
|
||
describe 'deactivations' do | ||
subject(:task_list) { described_class.new deactivations: [{ id: '123' }] } | ||
|
||
it { is_expected.to have_attributes deactivations: all(have_attributes(id: '123')) } | ||
it { is_expected.to have_attributes deactivations: all(be_a(Ioki::Model::Platform::Deactivation)) } | ||
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 |
---|---|---|
@@ -1,9 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe Ioki::Model::Platform::Task do | ||
describe 'new' do | ||
subject(:task_list) { described_class.new id: '123' } | ||
|
||
it { is_expected.to have_attributes(id: '123') } | ||
it { is_expected.to be_a(described_class) } | ||
end | ||
|
||
describe 'calculated_point' do | ||
subject(:task_list) { described_class.new calculated_point: { id: '123' } } | ||
|
||
it { is_expected.to have_attributes calculated_point: have_attributes(id: '123') } | ||
it { is_expected.to have_attributes calculated_point: be_a(Ioki::Model::Platform::CalculatedPoint) } | ||
end | ||
|
||
describe 'pause' do | ||
subject(:task_list) { described_class.new pause: nil, pause_id: '123' } | ||
|
||
it { is_expected.to have_attributes pause_id: '123' } | ||
it { is_expected.not_to respond_to :pause } | ||
end | ||
|
||
describe 'ride' do | ||
subject(:task_list) { described_class.new ride_id: '123' } | ||
|
||
it { is_expected.to have_attributes ride_id: '123' } | ||
it { is_expected.not_to respond_to :ride } | ||
end | ||
|
||
it { is_expected.to define_attribute(:id).as(:string) } | ||
it { is_expected.to define_attribute(:type).as(:string) } | ||
it { is_expected.to define_attribute(:created_at).as(:date_time) } | ||
it { is_expected.to define_attribute(:updated_at).as(:date_time) } | ||
it { is_expected.to define_attribute(:ride).as(:object).with(class_name: 'Ride') } | ||
it { is_expected.to define_attribute(:ride_id).as(:string) } | ||
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
Oops, something went wrong.