Skip to content

Commit

Permalink
feat: update first chapters
Browse files Browse the repository at this point in the history
  • Loading branch information
pmareke committed Oct 3, 2023
1 parent d7fc408 commit bfdc56c
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 3 deletions.
10 changes: 8 additions & 2 deletions content.en/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ type: docs
## Learn Test-Driven Development with Ruby

* Explore the Ruby language by writing tests.
* **Get a grounding with TDD**.
* Ruby is a good language for learning TDD because it is a simple language to learn and testing is built-in.
* Ruby is a good language for learning TDD because it is a simple language to learn and testing is really simple.
* Be confident that you'll be able to start writing robust, well-tested systems in Ruby.

## Who this is for

* People who are interested in picking up Ruby.
* People who already know some Ruby, but want to explore testing more.

## What you'll need
* A computer!.
* Installed [Ruby](/docs/before-start/install-ruby/).
* A text editor.
* Some experience with programming.
* Comfortable using the terminal.

## Feedback

* Add issues/submit PRs [here](https://github.com/pmareke/learn-ruby-with-tests) or [tweet me @pmareke](https://twitter.com/pmareke)
Expand Down
52 changes: 51 additions & 1 deletion content.en/docs/before-start/install-minitest.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
---
title: Install Minitest
weight: 3
weight: 4
---

# Install Minitest

For this book we're going to use [Minitest](https://github.com/minitest/minitest),
this testing tool was added to Ruby’s standard library.

## How to install Minitest

```sh
# Gemfile
source "https://rubygems.org"

gem "minitest"
```

```sh
bundle install
```

## Validate Minitest is installed

Once you have Minitest installed you need to create
a new file called `test_foo.rb` with the following code
(*right now don't care about it!*):

```ruby
require "minitest/autorun"

class TestFoo < Minitest::Test
def test_foo
assert_equal 1, 1
end
end
```
Save the file and run the following command in the terminal:

```sh
ruby test_foo.rb
```

You should see something like these results:

```sh
Run options: --seed 6109

# Running:

.

Finished in 0.000829s, 1206.0617 runs/s, 1206.0617 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
```
29 changes: 29 additions & 0 deletions content.en/docs/before-start/install-ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,32 @@ weight: 2
---

# Install Ruby

## How to install Ruby

There a couple of ways to install Ruby in your computer:

* You can go to the official [page](https://www.ruby-lang.org/en/documentation/installation/#package-management-systems)
and follow the given instructions for your operation system.
* You can use the Ruby Version Manager [RVM](http://rvm.io/rvm/install#basic-install).

## Validate Ruby is installed

Once you have Ruby installed you should be able to run the following command
in the terminal:

```sh
ruby -v # => ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
```

Also you should be able to open an interactive ruby shell using the following
command in the terminal:

```sh
irb
```
In which you can run Ruby code like this one:

```sh
irb(main):001> 1 + 1 # => 2
```
23 changes: 23 additions & 0 deletions content.en/docs/before-start/prepare-the-book.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Prepare the project
weight: 3
---

# Prepare the project for this book

## Create the folder for the chapters and its tests

```sh
mkdir tests src
```

## Create a new Ruby project

```sh
bundle init
```

```sh
# Gemfile
source "https://rubygems.org"
```

0 comments on commit bfdc56c

Please sign in to comment.