-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test models #30
Merged
Merged
Test models #30
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b3abd90
create tests for models
hetrox8 7517f9b
modify tests, modify order for associations in models
hetrox8 849c1ac
Update README.md
hetrox8 0905323
Merge branch 'dev' into test-models
hetrox8 0c09917
Update rails_helper.rb
hetrox8 a6cdadc
Update spec_helper.rb
hetrox8 993bddd
Update spec_helper.rb
hetrox8 8dcf457
Update Gemfile
hetrox8 d13dfd2
Update Gemfile
hetrox8 068b3c5
Update Gemfile
hetrox8 a6da522
Update Gemfile
hetrox8 391620b
Update README.md
hetrox8 8a6caf7
Update README.md
hetrox8 2774efc
Update README.md
hetrox8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
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,24 +1,157 @@ | ||
# README | ||
<a name="readme-top"></a> | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
<div align="center"> | ||
|
||
Things you may want to cover: | ||
</div> | ||
|
||
* Ruby version | ||
|
||
* System dependencies | ||
# 📗 Table of Contents | ||
|
||
* Configuration | ||
- [📖 About the Project](#about-project) | ||
- [🛠 Built With](#built-with) | ||
- [Tech Stack](#tech-stack) | ||
- [Key Features](#key-features) | ||
- [💻 Getting Started](#getting-started) | ||
- [Setup](#setup) | ||
- [Prerequisites](#prerequisites) | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [Run tests](#run-tests) | ||
- [👥 Authors](#authors) | ||
- [🔭 Future Features](#future-features) | ||
- [🤝 Contributing](#contributing) | ||
- [⭐️ Show your support](#support) | ||
- [🙏 Acknowledgements](#acknowledgements) | ||
- [❓ FAQ (OPTIONAL)](#faq) | ||
- [📝 License](#license) | ||
|
||
* Database creation | ||
# 📖 vehicle booking app <a name="about-project"></a> | ||
|
||
* Database initialization | ||
**vehicle booking app** is a Booking app made connectively with Ruby in Rails and React for front-end [vehicle booking app](https://github.com/tan12082001/Vehicle-Booking-App-Backend.git) React frontend App in JSON format through an API endpoint. | ||
|
||
* How to run the test suite | ||
## 🛠 Built With <a name="built-with"></a> | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
### Tech Stack <a name="tech-stack"></a> | ||
<details> | ||
<summary>Client</summary> | ||
<ul> | ||
<li><a href="https://react.dev/">React</a></li> | ||
<li><a href="https://react-redux.js.org/">React-Redux</a></li> | ||
<li><a href="https://redux-toolkit.js.org/">Redux Toolkit</a></li> | ||
</ul> | ||
</details> | ||
|
||
* Deployment instructions | ||
<details> | ||
- <summary>Server</summary> | ||
<ul> | ||
<li><a href="https://guides.rubyonrails.org/">Ruby on Rails</a></li> | ||
<li><a href="https://www.postgresql.org/docs/">PostgreSQL</a></li> | ||
</ul> | ||
</details> | ||
|
||
* ... | ||
### Key Features <a name="key-features"></a> | ||
|
||
- Rails API backend | ||
- React Front-end | ||
- Redux Toolkit used to consume the backend api | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
## 💻 Getting Started <a name="getting-started"></a> | ||
|
||
To get a local copy up and running, follow these steps: | ||
|
||
### Prerequisites | ||
|
||
In order to run this project you need: | ||
- A text editor of your choice ([VS Code](https://code.visualstudio.com/download) works well). | ||
- [Ruby and Rails](https://gorails.com/setup/windows/10) | ||
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) | ||
|
||
### Setup | ||
|
||
Use the following URL to clone this project: | ||
|
||
https://github.com/tan12082001/Vehicle-Booking-App-Backend.git | ||
|
||
### Install | ||
Open the terminal in the root directory of the project and run the following command to install all dependencies. | ||
|
||
bundle install | ||
npm i | ||
|
||
|
||
### Usage | ||
To start the development server, run the following command then navigate to `localhost:3000` in your browser. | ||
|
||
rails s | ||
|
||
Open [http://localhost:3000](http://localhost:3000/api/random_greeting) to view it in your browser. | ||
|
||
|
||
### Run tests | ||
There are no tests to run. | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
Comment on lines
+103
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add rspec as we just added the test suites. |
||
|
||
## 👥 Authors <a name="authors"></a> | ||
|
||
|
||
👤 **Suleiman Gacheru** | ||
|
||
- GitHub: [@hetrox8](https://github.com/hetrox8) | ||
- Twitter: [@suleimangacheru](https://twitter.com/suleimangacheru) | ||
|
||
|
||
👤 **Tanmayi manku** | ||
|
||
- GitHub: [@tan12082001](https://github.com/tan12082001) | ||
|
||
|
||
👤 **Winnie uzochukwu** | ||
|
||
- GitHub: [@winnie](https://github.com/Wineshuga) | ||
|
||
👤 **Winnie uzochukwu** | ||
|
||
- GitHub: [@toyybi bolaji](https://github.com/Simpleshaikh1) | ||
|
||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
|
||
## 🔭 Future Features <a name="future-features"></a> | ||
|
||
- None planned | ||
|
||
|
||
Comment on lines
+135
to
+139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to add at least two future features. |
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
## 🤝 Contributing <a name="contributing"></a> | ||
|
||
Contributions, issues, and feature requests are welcome! | ||
|
||
Feel free to check the [issues page](../../issues/). | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
## ⭐️ Show your support <a name="support"></a> | ||
|
||
|
||
If you like this project, please give it a star ⭐️ and share it with your friends. | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
|
||
## 🙏 Acknowledgments <a name="acknowledgements"></a> | ||
|
||
I would like to thank <a href="https://www.microverse.org/">Microverse</a> for providing the resources and guidelines that enabled me to complete this project. | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
|
||
|
||
## 📝 License <a name="license"></a> | ||
|
||
This project is [MIT](./LICENSE) licensed. |
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 +1 @@ | ||
fAtn19uLyNhgX/ZDtLX9gOmxM3j7ftyeD5FGXTr5TurQX1rvjgBdnm0UHa7hQW9zKTgW/8u36rGIsHkv7FXQNdQ973rqx622S76o7TTuxZ1ihrhKKDBZhb9L4tIxMOHhLxGvuUf8ztIP2LkuF6s4KhJxf5yQop+zKbasaxcdTHwAzNmx1E6gxiaQiRGSDqIkMKHllGjmc3rNT44N7z9I+h9Zm+J+mgrIcKU8lZ+tGbVNkE9dJoGGrWLFDeuP54liacjmiZACmMEq1E9QA7pyvDaL60PD678SLktthGbVbgySU2xg+TawbHTt9mkr458+padCCi3CV5JAcdKfG2uH8XgDdzKiXKXuFIkPNfhFL8msOhe0R0FiHlchWOelXYgMNAAbfR7Oxv2Rez08OCWn8DJFdmFf--1bfvO5+kKjsedmRn--3ahtbfXpTxPynTpxpi2WXg== | ||
Ub4GwFY64RuGmN4tF3T5NYa41bAEZFrbj2pAVHLkK0ERfIr8/I5mUxuJ2xQKuF2JRL2spC1jOhWTKyTS+7KphFxc25b4CuYsaBm5mI2Q4WGq+RdYKBr1F5fISRWFuEKVw0uSTg3Iu7wLvU0kBsyvrb4lvV15Q4ZrRLH74GDeZFGZMwbilbVX1Pjxv08GO/hHUksjZahlouqiYNtdVQU5ddM/TKScWeBiBt6VVl3r4u5Mmu9K2cIABpmGTaWWS1t8C+G9Afx93+8E4en9c+Vefn0jl0iP38ab9UrnzD5sV9jds/xSg5I1m/txc/OozZCypJRnIgifnEvas1U7thoZIkqMxNgqgtJ3wWM99gZPHMQ5APnMrwKamctsE9wjSNg9a6s9aj33EMBx+g2WdUkL2fLWM9LK--RXyuCv1yyZ786dyc--t1D0aqw6YPSrnsMMF+/oRA== |
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,10 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Car, type: :model do | ||
describe 'associations' do | ||
it { is_expected.to have_many(:my_reservations) } | ||
it { is_expected.to have_many(:users).through(:my_reservations) } | ||
end | ||
|
||
# Add tests for other validations here | ||
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,10 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe MyReservation, type: :model do | ||
describe 'associations' do | ||
it { is_expected.to belong_to(:user) } | ||
it { is_expected.to belong_to(:car) } | ||
end | ||
|
||
# Add tests for other validations here | ||
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,10 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe User, type: :model do | ||
describe 'associations' do | ||
it { is_expected.to have_many(:my_reservations) } | ||
it { is_expected.to have_many(:cars).through(:my_reservations) } | ||
end | ||
|
||
# Add tests for other validations here | ||
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,77 @@ | ||
# spec/rails_helper.rb | ||
|
||
# This file is copied to spec/ when you run 'rails generate rspec:install' | ||
require 'spec_helper' | ||
ENV['RAILS_ENV'] ||= 'test' | ||
require File.expand_path('../config/environment', __dir__) | ||
require 'rspec/rails' | ||
require 'shoulda/matchers' | ||
require 'database_cleaner' | ||
|
||
# Prevent database truncation if the environment is production | ||
abort('The Rails environment is running in production mode!') if Rails.env.production? | ||
|
||
# Checks for pending migrations and applies them before tests are run. | ||
# If you are not using ActiveRecord, you can remove these lines. | ||
begin | ||
ActiveRecord::Migration.maintain_test_schema! | ||
rescue ActiveRecord::PendingMigrationError => e | ||
abort e.to_s.strip | ||
end | ||
|
||
RSpec.configure do |config| | ||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures | ||
config.fixture_paths = [ | ||
Rails.root.join('spec/fixtures') | ||
] | ||
|
||
# If you're not using ActiveRecord, or you'd prefer not to run each of your | ||
# examples within a transaction, remove the following line or assign false | ||
# instead of true. | ||
config.use_transactional_fixtures = true | ||
|
||
# You can uncomment this line to turn off ActiveRecord support entirely. | ||
# config.use_active_record = false | ||
|
||
# Configure shoulda-matchers | ||
Shoulda::Matchers.configure do |shoulda_config| | ||
shoulda_config.integrate do |with| | ||
with.test_framework :rspec | ||
with.library :rails | ||
end | ||
end | ||
|
||
# Configure DatabaseCleaner | ||
config.before(:suite) do | ||
DatabaseCleaner.strategy = :transaction | ||
DatabaseCleaner.clean_with(:truncation) | ||
end | ||
|
||
config.before(:each) do | ||
DatabaseCleaner.start | ||
end | ||
|
||
config.after(:each) do | ||
DatabaseCleaner.clean | ||
end | ||
|
||
# RSpec Rails can automatically mix in different behaviours to your tests | ||
# based on their file location, for example enabling you to call `get` and | ||
# `post` in specs under `spec/controllers`. | ||
# | ||
# You can disable this behaviour by removing the line below, and instead | ||
# explicitly tag your specs with their type, e.g.: | ||
# | ||
# RSpec.describe UsersController, type: :controller do | ||
# # ... | ||
# end | ||
# | ||
# The different available types are documented in the features, such as in | ||
# https://rspec.info/features/6-0/rspec-rails | ||
config.infer_spec_type_from_file_location! | ||
|
||
# Filter lines from Rails gems in backtraces. | ||
config.filter_rails_from_backtrace! | ||
# arbitrary gems may also be filtered via: | ||
# config.filter_gems_from_backtrace("gem name") | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the npm i, as the dependencies will be installed through bundle install. Also let's add the instructions for generating the secret key.