This is a social media app where the user can create posts and send friendship invitations to other users as well.
This repo is for practicing the bi-directional self-referential relationships in ActiveRecord models.
It was built with Ruby on Rails, Rspec, and Capybara for unit and integration tests.
Here is a description of business requirements for the app:
- As a guest user:
- I want to be able to create account/log in.
- I can see only “Sign in” and “Sign out” page.
- As a logged-in user:
- I want to be able to see all users list.
- I want to be able to see selected user page with their user name and all posts written by them (the most recent posts on the top).
- I want to be able to send a friendship invitation.
- I want to see a button “Invite to friendship” next to the name of user who is not my friend yet - on both users’ list and single user page.
- I want to be able to see pending friendship invitations sent to me from other users.
- I want to be able to accept or reject friendships invitation.
- I want to be able to create new posts (text only).
- I want to be able to like/dislike posts (but I can like single post only once).
- I want to be able to add comments to posts.
- I want to be able to see “Timeline” page with posts (with number of likes and comments) written by me and all my friends (the most recent posts on the top).
- Timeline page should be the root page of the app.
You can try it here.
- Ruby 2.7,
- Rails 5.2.4,
- Postgres: 9.5,
- Rspec 3.9,
- Capybara 2.15,
- Shoulda-matchers 4.0,
- Webdrivers 4.0,
- Rubocop 0.79.0
To get a local copy up and running follow these simple example steps.
You need to install:
- Ruby language.
- Rubygems.
- Rails.
- PostgreSQL.
- An IDE (Integrated Development Environment).
- Clone the repository.
- In your OS terminal search the repository's address and to install gems run:
$bundle install
- To setup database.
$rails db:create
$rails db:migrate
- Then start Rail's server.
$rails server
- Open
http://localhost:3000/
in your browser. - Follow the instructions.
Unit tests for:
- Models Associations.
- Models Validations.
Integration tests for:
- Authentications.
- Posts.
- Friendships.
- Notifications.
- Comments.
- Likes.
In your terminal search the repository's address and run:
$ rspec --format documentation
It will provide you well-organized output on your terminal with information about the tests.
To deploy on Heroku you can check this tutorial from the Odin Project.
After pushing the last changes to the remote repository, follow this steps:
- $
heroku create
- Verify that you see heroku in the output.
$git remote
- This will push the master branch.
$git push heroku master
In case you want to push another branch you can run
$git push heroku <branch name>:master
- Migrate the database on Heroku
$heroku run rails db:migrate
- Open the app
$heroku open
- Users can create an account.
- Validates the email.
- To login is necessary to submit email.
- The user can create posts and send friendship requests.
- The user can only read friends' posts.
- Has a notification section that shows pending requests.
- Users have a profile picture.
Rossiel Carranza
- Github: @RossielCS
- Linkedin: Rossiel Carranza
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
This project is MIT licensed.