Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alejandroq12/api-testing-rspec
The API Testing Spec is a project designed to practice API testing with RSpec.
https://github.com/alejandroq12/api-testing-rspec
rspec ruby-on-rails
Last synced: about 2 months ago
JSON representation
The API Testing Spec is a project designed to practice API testing with RSpec.
- Host: GitHub
- URL: https://github.com/alejandroq12/api-testing-rspec
- Owner: Alejandroq12
- License: other
- Created: 2024-01-17T18:29:07.000Z (about 1 year ago)
- Default Branch: dev
- Last Pushed: 2024-01-18T20:53:17.000Z (about 1 year ago)
- Last Synced: 2024-12-18T17:12:46.522Z (about 2 months ago)
- Topics: rspec, ruby-on-rails
- Language: Ruby
- Homepage:
- Size: 241 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# api-testing-spec
API Testing Spec
# 📗 Table of Contents- [api-testing-spec](#api-testing-spec)
- [📗 Table of Contents](#-table-of-contents)
- [📖 API Testing Spec ](#-api-testing-spec-)
- [🛠 Built With ](#-built-with-)
- [Tech Stack ](#tech-stack-)
- [Key Features ](#key-features-)
- [💻 Getting Started ](#-getting-started-)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Install](#install)
- [Database](#database)
- [Usage](#usage)
- [Run tests](#run-tests)
- [Run linter](#run-linter)
- [Deployment](#deployment)
- [Test with postman](#test-with-postman)
- [👥 Authors ](#-authors-)
- [🔭 Future Features ](#-future-features-)
- [🤝 Contributing ](#-contributing-)
- [⭐️ Show your support ](#️-show-your-support-)
- [🙏 Acknowledgments ](#-acknowledgments-)
- [❓ FAQ ](#-faq-)
- [📝 License ](#-license-)The API Testing Spec is a project designed to practice API testing. This project is based on a written tutorial, which I will reference below. I chose a written tutorial because, after creating this small project, I plan to implement testing in my own project, utilizing the knowledge I gained from here, alongside reading the documentation and some books.
- **Use RSpect to test API**
To get a local copy up and running, follow these steps.
### Prerequisites
In order to run this project you need:
[Install Ruby](https://www.ruby-lang.org/en/documentation/installation/)
### Setup
```sh
cd my-folder
git clone https://github.com/Alejandroq12/api-testing-rspec.git
```
### Install
Install all necessary dependencies listed in the `Gemfile`.
```sh
bundle install
```
### Database
Create databse:
```sh
rake db:create
```
Run migrations:
```sh
rails db:migrate
```
Add the seeds(omit it for this project):
```sh
rails db:seed
```
### Usage
To run the project, navigate to the project directory and execute the following command:
```sh
rails server
```
### Run tests
To run tests, run the following command:
```sh
rspec
```
### Run linter
To run linter, run the following command:
```sh
rubocop
```
### Deployment
You can deploy this project using:
Not available at the moment.
### Test with postman
Send a POST request with valid parameters:
![Alt text]()
Answer of a POST request with valid parameters:
![Alt text](postman_one_valid_parameters.png)
Send a POST request with invalid parameters:
![Alt text](test_postman_two.png)
Error as a result of a POST request with invalid parameters:
![Alt text](error_postman_two_invalid.png)
👤 **Julio Quezada**
- GitHub: [Alejandroq12](https://github.com/Alejandroq12)
- Twitter: [@JulioAle54](https://twitter.com/JulioAle54)
- LinkedIn: [Julio Quezada](https://www.linkedin.com/in/quezadajulio/)
- [] **Test CRUD actions.**
- [] **Create a health check controller.**
- [] **Create a CRUD acaffold.**
- [] **Test autehtication.**
Contributions, issues, and feature requests are welcome!
If you like this project please give a star.
Thanks in advance.
I would like to thank Axel Kee for creating the written tutorial for this project [Axel Kee](https://rubyyagi.com/rspec-request-spec/)
**What did you learn?**
- I learned a lot about testing CRUD actions, testing authentication, testing request specs, and setting up a Rails app.
This project is [MIT](./LICENSE) licensed.