Skip to content

Commit 4319d22

Browse files
add rspec to rails
1 parent 90cb686 commit 4319d22

11 files changed

Lines changed: 1009 additions & 131 deletions

File tree

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,68 @@
1-
# Chapter I
1+
# Chapter I - Introduction to Ruby
22
`(avr. time for this chapter: 1 day)`
33

4-
Hi.
5-
Ruby is an interpreted, high-level, general-purpose programming language which supports multiple programming paradigms. It was designed with an emphasis on programming productivity and simplicity. In Ruby, everything is an object, including primitive data types. It was developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan.
4+
Ruby is an interpreted, high-level, general-purpose programming language that supports multiple programming paradigms. Designed with an emphasis on programming productivity and simplicity, Ruby treats everything as an object, including primitive data types. It was developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan.
65

7-
Ruby is dynamically typed and uses garbage collection and just-in-time compilation. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming.
6+
Ruby is dynamically typed and uses garbage collection and just-in-time compilation. It supports procedural, object-oriented, and functional programming paradigms.
87

9-
In this chapter the objective is to look at the world of ruby, which will serve as a basis for the next chapters where we will be delving into one of the frameworks that work with ruby, Rails.
8+
In this chapter, the objective is to explore the fundamentals of Ruby, which will serve as the foundation for the next chapters where you will delve into Rails, one of the most popular frameworks built with Ruby.
109

11-
The idea is to familiarize yourself with the basics.
10+
## Ruby in Twenty Minutes
1211

13-
***So, let's code***
12+
A concise Ruby tutorial that should take no more than 20 minutes to complete.
1413

14+
### Steps to implement:
1515

16-
# Let's Start
16+
1. Ensure Ruby is installed on your system
17+
2. Complete the quick start tutorial
18+
3. Experiment with the Interactive Ruby Shell (IRB)
1719

18-
## Ruby in Twenty Minutes (quick start)
20+
> Reference: [Ruby Quick Start](https://www.ruby-lang.org/en/documentation/quickstart/)
1921
20-
This is a small Ruby tutorial that should take no more than 20 minutes to complete: [https://www.ruby-lang.org/en/documentation/quickstart/](https://www.ruby-lang.org/en/documentation/quickstart/)
22+
> Installation Guide: [Ruby Installation](https://www.ruby-lang.org/en/documentation/installation/)
2123
22-
It makes the assumption that you already have Ruby installed. If not, checkout this link: [https://www.ruby-lang.org/en/documentation/installation/] (https://www.ruby-lang.org/en/documentation/installation/)
24+
## Ruby Koans
2325

24-
## Ruby Koans
26+
The Koans guide you along the path to enlightenment in order to learn Ruby. The goal is to understand the Ruby language, syntax, structure, and common functions and libraries through test-driven exercises.
2527

26-
The Koans walk you along the path to enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. Testing is not just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language.
27-
http://rubykoans.com
28+
### Steps to implement:
2829

29-
- **Recommended Koans**:
30-
- About_arrays.rb
31-
- About_blocks.rb
32-
- About_classes.rb
33-
- About_control_statements.rb
34-
- About_hashes.rb
35-
- About_iteration.rb
36-
- About_methods.rb
37-
- About_strings.rb
38-
- about_symbols.rb
30+
1. Clone or download the Ruby Koans repository
31+
2. Run the koans and fix each failing test
32+
3. Focus on the recommended koans listed below
33+
34+
> Reference: [Ruby Koans](http://rubykoans.com)
35+
36+
### Recommended Koans:
37+
38+
- `about_arrays.rb`
39+
- `about_blocks.rb`
40+
- `about_classes.rb`
41+
- `about_control_statements.rb`
42+
- `about_hashes.rb`
43+
- `about_iteration.rb`
44+
- `about_methods.rb`
45+
- `about_strings.rb`
46+
- `about_symbols.rb`
3947

4048
## Ruby Tutorial
4149

42-
This tutorial has been prepared for beginners to help them understand the basic to advanced concepts related to Ruby Scripting languages.
43-
https://www.tutorialspoint.com/ruby/index.htm
50+
This tutorial covers basic to advanced concepts related to Ruby scripting.
51+
52+
### Steps to implement:
53+
54+
1. Read and practice the following topics
55+
2. Write small code snippets to reinforce each concept
56+
3. Understand how these concepts apply to real-world scenarios
57+
58+
> Reference: [TutorialsPoint Ruby](https://www.tutorialspoint.com/ruby/index.htm)
59+
60+
### Topics to cover:
4461

45-
- Ruby - Classes and Objects
46-
- Ruby - Variables
47-
- Ruby - Operators
48-
- Ruby - Methods
49-
- Ruby - Blocks (same as Koans)
50-
- Ruby - Modules
51-
- Ruby - Exceptions
62+
- Ruby - Classes and Objects
63+
- Ruby - Variables
64+
- Ruby - Operators
65+
- Ruby - Methods
66+
- Ruby - Blocks
67+
- Ruby - Modules
68+
- Ruby - Exceptions
Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,54 @@
1-
2-
# Chapter II
1+
# Chapter II - Introduction to Ruby on Rails
32
`(avr. time for this chapter: 2 days)`
43

5-
Ruby on Rails (simplified as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web pages.
4+
Ruby on Rails (commonly referred to as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails follows the Model-View-Controller (MVC) architectural pattern, providing default structures for databases, web services, and web pages.
5+
6+
In this chapter, the objective is to understand how Rails works. This is primarily a learning phase—you do not need to write extensive code, only what helps reinforce your understanding. Focus on comprehension rather than implementation.
7+
8+
The recommended course has several chapters, but for this onboarding, we focus on the essentials that will prepare you for the practical exercises ahead.
9+
10+
## Udemy Course
11+
12+
We recommend the following comprehensive course for learning Ruby on Rails.
13+
14+
### Steps to implement:
15+
16+
1. Obtain your course credentials from your tutor
17+
2. Watch the recommended chapters listed below
18+
3. Take notes on key concepts
19+
4. Repeat sections if clarification is needed
20+
21+
> Reference: [The Complete Ruby on Rails Developer Course](https://www.udemy.com/course/the-complete-ruby-on-rails-developer-course)
22+
23+
### Recommended Chapters:
24+
25+
**Chapter 2 - Introduction**
26+
27+
- Rails basics Introduction (1st video)
628

7-
This second chapter is geared towards learning rails. You don't need to write code (just what you think will help you), you need to understand how rails works
29+
**Chapter 3 - MVC and Application Structure**
830

9-
The course we offer you has several chapters that you can read, but in this case we are focused on the essentials for the next chapters.
31+
- Model, View, Controller and Rails App Structure
32+
- Root route, controller, more MVC and say 'Hello World!'
33+
- Structure of a Rails application
34+
- The back-end: CRUD, scaffold and wrap-up
1035

11-
The idea is to pay attention to the chapter you are listening to and repeat it if you have any doubts.
12-
13-
***So, let's learn some new things***
36+
**Chapter 4 - Working with Data**
1437

38+
- Tables, migrations and naming conventions
39+
- Validations
40+
- Show articles (route, action and view)
41+
- Articles index
42+
- Forms - build a new article creation form
43+
- Edit and update: update existing articles
44+
- Delete: delete articles
45+
- DRY (Don't Repeat Yourself) code - refactoring and partials
1546

16-
# Udemy Course
47+
**Chapter 6 - Associations (Part 1)**
1748

18-
Currently, we use this course: https://www.udemy.com/course/the-complete-ruby-on-rails-developer-course
19-
> get your credentials with your tutor.
49+
- One to many association
2050

51+
**Chapter 7 - Associations (Part 2)**
2152

22-
- Rails basics Introduction-> Chapter 2 (1st video)
23-
- Model, View, Controller and Rails App Structure (Chapter 3)
24-
- Root route, controller, more MVC and say 'Hello World!' (Chapter 3)
25-
- Structure of a Rails application (Chapter 3)
26-
- The back-end: CRUD, scaffold and wrap-up (Chapter 3)
27-
- Tables, migrations and naming conventions (Chapter 4)
28-
- Validations (Chapter 4)
29-
- Show articles (route, action and view) (Chapter 4)
30-
- Articles index (Chapter 4)
31-
- Forms - build a new article creation form (Chapter 4)
32-
- Edit and update: update existing articles (Chapter 4)
33-
- Delete: delete articles (Chapter 4)
34-
- DRY (Don't Repeat Yourself) code - refactoring and partials (Chapter 4)
35-
- One to many association (Chapter 6)
36-
- Many-to-many association - introduction (Chapter 7)
37-
- Many-to-many association - back-end implementation (Chapter 7)
53+
- Many-to-many association - introduction
54+
- Many-to-many association - back-end implementation
Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,58 @@
1-
2-
# Chapter III
1+
# Chapter III - Practical Exercise: Ebook Store (Part 1)
32
`(avr. time for this chapter: 3 to 4 days)`
43

5-
Moving on from the theoretical part, we move on to the practical part.
4+
Moving from theory to practice, this chapter presents a hands-on exercise where you will build a Rails application from scratch.
5+
6+
The requirements listed below are intentionally generic. This approach mirrors real-world scenarios where client requirements are often open to interpretation. As an engineer, you are expected to analyze, design, and implement solutions based on the given specifications. If you have questions or need clarification, discuss ideas with your tutor—just as you would in a professional environment.
7+
8+
These topics align with what you learned in the previous chapter, so the implementation should feel familiar.
9+
10+
## Project Setup
11+
12+
### Steps to implement:
13+
14+
1. Create a new Rails application using MVC architecture
15+
2. Initialize a Git repository and grant access to your tutor
16+
3. (Optional) Deploy the application to a platform of your choice (e.g., [Render](https://render.com), [Heroku](https://heroku.com))
17+
18+
## Application Requirements
19+
20+
Build an online ebook store application. The platform will have sellers and buyers. You will not implement shopping cart logic, but you will implement functionalities related to purchasing actions.
21+
22+
### Core Features
23+
24+
#### User Management
25+
26+
- Create CRUD operations for Users (can be either seller or buyer)
27+
- Implement user status management (enable/disable)
28+
29+
#### Ebook Management
630

7-
You'll find several topics listed below, with very little detail. The details do not exist on purpose, it is in everyone's interest to understand how you can infer, through a practical case, the same thing that would happen in real life with a client. As an engineer you know how to think, and if you have doubts you can always do what you would do in a real project, discuss ideas. You can also design your solution before trying it out.
31+
- Create CRUD operations for Ebooks
32+
- Implement status workflow for Ebooks (Draft → Pending → Live)
33+
- Store PDF preview drafts available for download
834

9-
These topics are still the most basic so you don't need to build or model a very elaborate system, if you notice they are linked to the course you just saw in the previous chapter.
35+
#### Navigation
1036

11-
***So, let's code***
37+
- Add a navigation menu with links to Ebooks and Users sections
1238

13-
# Let's do some basic code
39+
### Purchase Functionality
1440

15-
> create a simple rails application MVC
16-
> open a git repository and give access to your tutor
17-
> IF you have time deploy it, you can choose the platform (render.com, heroku.com)
41+
> Note: For email functionality, you do not need to send actual emails. Create the notification logic only, or use [Mailcatcher](https://mailcatcher.me) for local testing.
1842
19-
Let's build an application from scratch. The application will have as its theme the sale of ebooks online. A virtual store where you will have sellers and buyers. You won't have to implement the cart's logic, but some functionalities related to some actions that are performed when buying an item.
43+
#### Steps to implement:
2044

21-
As previously mentioned, all the points below are generic, it is up to the developer who develops to build an architecture consistent with the proposed objective
45+
1. Implement an ebook purchase action (without cart logic)
46+
2. The purchase button should trigger the following actions:
47+
- Send an email to the seller with their commission (10% of the book price)
48+
- Send an email with ebook statistics (examples below)
49+
- Register the purchase in the database
2250

23-
- List item (ebooks)
24-
- Add navigation menu with ebook and users
25-
- Create CRUD for the user (seller or a buyer)
26-
- Update Status of the user (enable or disable)
27-
- Create CRUD for Ebooks
28-
- Update Status for the Ebook (Draft, Pending, Live)
29-
- Store PDF with the preview draft for download
51+
#### Suggested Statistics to Track:
3052

31-
> the emails referenced below do not need to be sent, it is only necessary to create the notification logic, or you can use **mailcatcher.me**
53+
- Number of times the ebook was purchased
54+
- Number of times the preview PDF was viewed
55+
- Number of times the ebook page was visited
56+
- Visitor information (IP, browser, location, etc.)
3257

33-
- buy ebook (**don't apply cart logic**),
34-
- the buy button should trigger 2 actions (send mail to the user with the fee he get from the bought ebook 10% from the book price, send an email with all statistics from that ebook (how many times the ebook was bought, how many times the draft pdf has been viewed, how many times ebook has been seen, IP, browser, location, etc ... )) **note: you can find different metrics and not use these**
35-
- Register the book purchase
58+
> Note: You may define different metrics based on your implementation approach.
Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
1-
2-
# Chapter IV
1+
# Chapter IV - Practical Exercise: Ebook Store (Part 2)
32
`(avr. time for this chapter: 3 days)`
43

5-
This will be the last topic that closes onBoarding.
6-
The topics are broader, which will force you to think better before starting to implement. Following the previous exercise, here's your challenge
4+
This chapter concludes the base onboarding with advanced features for your ebook store application. The topics are broader and will require more careful planning before implementation.
5+
6+
Continue building upon the application from Chapter III.
7+
8+
## Project Finalization
9+
10+
### Steps to implement:
11+
12+
1. Create pull requests for your features
13+
2. Merge all completed code into the main branch
14+
3. (Optional) Deploy the final application to a platform of your choice (e.g., [Render](https://render.com), [Heroku](https://heroku.com))
15+
16+
## Advanced Features
17+
18+
### Image Management
19+
20+
- Implement user profile image upload and storage
21+
- Implement ebook cover image upload and storage
22+
23+
### Authentication System
24+
25+
Implement a custom authentication system **without using Devise**.
26+
27+
#### Steps to implement:
28+
29+
1. Create user registration (sign up) functionality
30+
2. Create user login (sign in) functionality
31+
3. Implement `sign_in` and `sign_out` helper methods
32+
4. On successful login, redirect users to their previous location (not the root URL)
33+
34+
### Password Management
35+
36+
- Create a Rake task that forces password updates every 6 months
37+
- Send a welcome email when a new user registers
738

8-
***So, let's finish this***
39+
> Note: For email functionality, create the notification logic only, or use [Mailcatcher](https://mailcatcher.me) for local testing.
940
10-
# Let's do some basic code
41+
### Tags System
1142

12-
> commit your pull request and in the end merge all the code into (main/master)
13-
> IF you have time deploy it, you can choose the platform (render.com, heroku.com, etc ...)
43+
#### Steps to implement:
1444

15-
- Store user image profile
16-
- Store ebook image cover profile
17-
- Implement Authentication **without devise**. sign up and sign in
18-
- on Successfully Login redirect to same point where you were and not the root url
19-
- Force to update password every 6 months
20-
- send an welcome mail when a new user is registered
21-
- Implement a Tags System
22-
- Filter Tags on ebooks
23-
- Filter ebooks by user
45+
1. Implement a tagging system for ebooks
46+
2. Add filtering functionality:
47+
- Filter ebooks by tags
48+
- Filter ebooks by user (seller)
2449

25-
> when a user has no articles it will not show on filters list
26-
> the emails referenced below do not need to be sent, it is only necessary to create the notification logic, or you can use **mailcatcher.me**
50+
> Note: Users with no ebooks should not appear in the filter list.

0 commit comments

Comments
 (0)