-
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 #14 from Fatima-hub333/feature/vehicle-model-update
Feature/vehicle model update
- Loading branch information
Showing
13 changed files
with
73 additions
and
38 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,5 @@ | ||
class AddVisbleToVehicle < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :vehicles, :visible, :boolean | ||
end | ||
end |
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 |
---|---|---|
|
@@ -9,11 +9,9 @@ | |
|
||
user1 = User.create!(name: 'John Doe', email: '[email protected]', password: 'test123', roles: ['admin']) | ||
user2 = User.create!(name: 'Jane Doe', email: '[email protected]', password: 'test123', roles: ['admin']) | ||
user1.confirm | ||
user2.confirm | ||
veh1 = Vehicle.create!(brand: 'BWM', model: 'BMW-30', image: 'image-bmw', price: 80, description: 'good and lightspeed with low consumptiom') | ||
veh2 = Vehicle.create!(brand: 'Macendiz', model: 'Benz-30', image: 'image-Benz', price: 90, description: 'good and lightspeed with low consumptiom') | ||
veh3 = Vehicle.create!(brand: 'G-Wagon', model: 'G-wagon-15', image: 'image-wagon', price: 95, description: 'good and lightspeed with low consumptiom') | ||
veh1 = Vehicle.create!(brand: 'BWM', model: 'BMW-30', image: 'image-bmw', price: 80, visible: true, description: 'good and lightspeed with low consumptiom') | ||
veh2 = Vehicle.create!(brand: 'Macendiz', model: 'Benz-30', image: 'image-Benz', price: 90, visible: true,description: 'good and lightspeed with low consumptiom') | ||
veh3 = Vehicle.create!(brand: 'G-Wagon', model: 'G-wagon-15', image: 'image-wagon', price: 95, visible: true, description: 'good and lightspeed with low consumptiom') | ||
res1 = Reservation.create!(user: user1, vehicle: veh1, date: '24-09-2022', city: 'bravos') | ||
res1 = Reservation.create!(user: user2, vehicle: veh1,date: '24-09-2022', city: 'capetown') | ||
res1 = Reservation.create!(user: user2, vehicle: veh3,date: '24-09-2022', city: 'lusaka') | ||
|
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 |
---|---|---|
|
@@ -3,9 +3,7 @@ | |
RSpec.describe 'users/sign_in', type: :request do | ||
context 'sign_in' do | ||
before(:each) do | ||
Rails.application.load_seed | ||
User.find_by(email: '[email protected]').confirm | ||
post user_session_path, params: { email: '[email protected]', password: 'test123' } | ||
post user_session_path, params: { email: '[email protected]', password: 'test123' } | ||
end | ||
it 'Responds with ok status' do | ||
puts response | ||
|
@@ -18,7 +16,7 @@ | |
end | ||
it 'Responds data has the email of the user signed in' do | ||
data = JSON.parse(response.body)['data'] | ||
expect(data['email']).to eq('john@gmail.com') | ||
expect(data['email']).to eq('john123@gmail.com') | ||
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
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 |
---|---|---|
|
@@ -3,9 +3,7 @@ | |
RSpec.describe 'users/sign_out', type: :request do | ||
context 'sign-out existing session' do | ||
before do | ||
Rails.application.load_seed | ||
User.find_by(email: '[email protected]').confirm | ||
post user_session_path, params: { email: '[email protected]', password: 'test123' } | ||
post user_session_path, params: { email: '[email protected]', password: 'test123' } | ||
delete destroy_user_session_path | ||
end | ||
it 'Responds with ok status' do | ||
|
@@ -17,7 +15,7 @@ | |
end | ||
it 'Responds data has email of the user signed out' do | ||
data = JSON.parse(response.body)['data'] | ||
expect(data['email']).to eq('john@gmail.com') | ||
expect(data['email']).to eq('john123@gmail.com') | ||
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 |
---|---|---|
|
@@ -16,8 +16,6 @@ | |
} | ||
|
||
response(200, 'successful') do | ||
@user = User.last | ||
@user.confirm | ||
let(:params) { { email: '[email protected]', password: 'test123' } } | ||
example 'application/json', :successfull_login, { | ||
status: 'Success', | ||
|
@@ -47,5 +45,21 @@ | |
end | ||
end | ||
end | ||
|
||
path '/users/sign_out' do | ||
delete('delete session') do | ||
tags 'Sign-out' | ||
description ' Signs out user in session' | ||
produces 'application/json' | ||
|
||
response(401, 'unauthorized') do | ||
example 'application/json', :unauthorized, { | ||
status: 'Failed', | ||
message: 'There is no user to sign out' | ||
} | ||
run_test! | ||
end | ||
end | ||
end | ||
end | ||
# rubocop:enable Metrics/BlockLength |
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