-
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.
Merge pull request #35 from rubydevi/f/iterations-tests
Changes Requested:Readme:correct test command
- Loading branch information
Showing
22 changed files
with
141 additions
and
60 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
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 was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,5 @@ | ||
{ | ||
"dependencies": { | ||
"react-hot-toast": "^2.4.1" | ||
} | ||
} |
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,76 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Aeroplane, type: :model do | ||
describe 'validations' do | ||
it 'name should be present' do | ||
aeroplane = Aeroplane.new(model: '[email protected]', | ||
image: 'image 1', | ||
description: 'Description of the planes', | ||
number_of_seats: 6, | ||
location: 'Middle Earth', | ||
fee: 60.0) | ||
expect(aeroplane).to_not be_valid | ||
end | ||
|
||
it 'model should be present' do | ||
aeroplane = Aeroplane.new(name: 'Dragon 1', | ||
image: 'image 1', | ||
description: 'Description of the planes', | ||
number_of_seats: 6, | ||
location: 'Middle Earth', | ||
fee: 60.0) | ||
expect(aeroplane).to_not be_valid | ||
end | ||
|
||
it 'image should be present' do | ||
aeroplane = Aeroplane.new(name: 'Dragon 1', | ||
model: 'Jet', | ||
description: 'Description of the planes', | ||
number_of_seats: 6, | ||
location: 'Middle Earth', | ||
fee: 60.0) | ||
expect(aeroplane).to_not be_valid | ||
end | ||
|
||
it 'description should be present' do | ||
aeroplane = Aeroplane.new(name: 'Dragon 1', | ||
image: 'image 1', | ||
model: 'Jet', | ||
number_of_seats: 6, | ||
location: 'Middle Earth', | ||
fee: 60.0) | ||
expect(aeroplane).to_not be_valid | ||
end | ||
|
||
it 'number_of_seats should be present' do | ||
aeroplane = Aeroplane.new(name: 'Dragon 1', | ||
image: 'image 1', | ||
model: 'Jet', | ||
description: 'Description of the planes', | ||
location: 'Middle Earth', | ||
fee: 60.0) | ||
expect(aeroplane).to_not be_valid | ||
end | ||
|
||
it 'location should be present' do | ||
aeroplane = Aeroplane.new(name: 'Dragon 1', | ||
image: 'image 1', | ||
model: 'Jet', | ||
description: 'Description of the planes', | ||
number_of_seats: 6, | ||
fee: 60.0) | ||
expect(aeroplane).to_not be_valid | ||
end | ||
|
||
it 'fee should be greater than 0' do | ||
aeroplane = Aeroplane.new(name: 'Dragon 1', | ||
image: 'image 1', | ||
model: 'Jet', | ||
description: 'Description of the planes', | ||
number_of_seats: 6, | ||
location: 'Middle Earth', | ||
fee: -1) | ||
expect(aeroplane).to_not be_valid | ||
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,40 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Reservation, type: :model do | ||
let(:user) do | ||
User.new(name: 'bob', email: '[email protected]', password: 'password12', password_confirmation: 'password12') | ||
end | ||
before { user.save } | ||
|
||
let(:plane) do | ||
Aeroplane.new(name: 'boning 777', model: '[email protected]', image: 'image 1', description: 'Description of the planes', | ||
number_of_seats: 6, location: 'Middle Earth', fee: 60.0) | ||
end | ||
before { plane.save } | ||
let(:reservation) do | ||
Reservation.new(reserved_date: '2023-11-11', start_time: '18:24', end_time: '20:25', start_location: 'addis ababa', | ||
destination: 'india', user_id: user.id, aeroplane_id: plane.id) | ||
end | ||
before { reservation.save } | ||
context 'when testing the Reservation class' do | ||
it 'should have user ' do | ||
reservation.user_id = nil | ||
expect(reservation).to_not be_valid | ||
end | ||
it 'should have areoplane ' do | ||
reservation.aeroplane_id = nil | ||
expect(reservation).to_not be_valid | ||
end | ||
it 'should have resevation date ' do | ||
reservation.destination = nil | ||
expect(reservation).to_not be_valid | ||
end | ||
it 'should have destination ' do | ||
reservation.reserved_date = nil | ||
expect(reservation).to_not be_valid | ||
end | ||
it 'should have pass if all valid ' do | ||
expect(reservation).to be_valid | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.