Skip to content
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

Typo and details #29156

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ leapyears
leapYears
falsy
warmup
procs
enumerables
Comment on lines +9 to +10
Copy link
Member

@xandora xandora Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Because and This PR sections of the PR don't explain what this change is doing. Can you elaborate on this?

2 changes: 1 addition & 1 deletion ruby/automated_testing/rspec_part_two_code_sharing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

We will once again be working from the `odin_rspec` project we set up in the previous lesson. To get the most out this lesson, please follow along with all the examples.

### Learning Outcomes

Check failure on line 7 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Required heading structure

ruby/automated_testing/rspec_part_two_code_sharing.md:7 TOP004/lesson-headings Required heading structure [Expected: ### Lesson overview; Actual: ### Learning Outcomes] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP004.md

- What is a before hook and what phase of a test should you use it for?
- What is an after hook and phase of a test should you use it for?
Expand All @@ -21,7 +21,7 @@

To see this in action, create a new file in the lib directory of your `odin_rspec` project named `user.rb` and paste the following code into it:

~~~ruby

Check failure on line 24 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:24 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~ruby"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md
# lib/user.rb

class User
Expand All @@ -37,11 +37,11 @@
age >= 65
end
end
~~~

Check failure on line 40 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:40 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md

Next, create a test file for the user class in the spec directory named `user_spec.rb` and write the following tests for the `User` class to exercise the name, email and age attributes:

~~~ruby
~~~~ruby

Check failure on line 44 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:44 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "````"; Actual: "~~~~"] [Context: "~~~~ruby"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code fences need to be wrapped with 3 tildes, not 4. This seems like an incorrect change.

# spec/user_spec.rb

require "spec_helper"
Expand Down Expand Up @@ -74,7 +74,7 @@
end

end
~~~

Check failure on line 77 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:77 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md

Run the tests to make sure everything is wired together correctly. We can run just the tests for this user class by passing the test file name to the `rspec` command: `$rspec spec/user_spec.rb` .

Expand All @@ -84,7 +84,7 @@

In our case, we can include a before hook that will create a new `User` instance and assign that instance to a `@user` instance variable that we can use in each of our tests:

~~~ruby

Check failure on line 87 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:87 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~ruby"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md
# spec/user_spec.rb

require "spec_helper"
Expand Down Expand Up @@ -115,18 +115,18 @@
end

end
~~~

Check failure on line 118 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:118 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md

By default, before hooks run *before* each test in the same example group. We can see this a bit more clearly by including a puts statement in our before hook:

~~~ruby

Check failure on line 122 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:122 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~ruby"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md
# spec/user_spec.rb

before do
puts "running the before hook"
@user = User.new("David", "[email protected]", 30)
end
~~~

Check failure on line 129 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:129 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md

Now, when we run our tests again we should see "running the before hook" printed to the screen three times, once for each of our tests.

Expand All @@ -134,7 +134,7 @@

Change the before hook to the following and run the tests. The puts statement will only print once in the terminal, proving the before block was only executed once.

~~~ruby

Check failure on line 137 in ruby/automated_testing/rspec_part_two_code_sharing.md

View workflow job for this annotation

GitHub Actions / Lint lesson files

Fenced code blocks should use backticks instead of tildes

ruby/automated_testing/rspec_part_two_code_sharing.md:137 TOP008/use-backticks-for-fenced-code-blocks Fenced code blocks should use backticks instead of tildes [Expected: "```"; Actual: "~~~"] [Context: "~~~ruby"] https://github.com/TheOdinProject/curriculum/blob/main/markdownlint/docs/TOP008.md
# spec/user_spec.rb

before(:all) do
Expand Down
11 changes: 7 additions & 4 deletions ruby/automated_testing/test_driven_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
So far you’ve been learning how to test code that you’ve written, but there’s a popular development process that flips that concept on its head. Rather than writing code, manually testing it until you get it working, then writing a test to make sure it stays working; you can write the test **before** the code, so that you don’t have to waste *any* time manually testing. Test Driven Development is the name of this inverted development process.

### Learning Outcomes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine.

Look through these now and use them to guide your learning. By the end of this lesson, expect to:

- Learn what Test Driven Development is
Expand Down Expand Up @@ -30,6 +31,7 @@ This development cycle is known as red-green-refactor, and it’s at the heart o
One key aspect of the red-green-refactor cycle that *isn’t* in the name, is that the code you write to go from `red` to `green` should be the **minimum** amount required to pass the test. If you find that the functionality you’re adding actually does *more* than is being tested, that is a sign that your method is likely doing too much, or possibly that your tests aren’t testing all of the right functionality.

#### TDD Examples

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine.

Let’s walk through a TDD approach to a basic class.

Given the general problem:
Expand Down Expand Up @@ -210,6 +212,7 @@ TODO: Exercise: TDD a value object
TODO: Exercise: TDD a class that has a collaborator which doesn't exist yet using mocks

### Additional Resources

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine.

This section contains helpful links to other content. It isn't required, so consider it supplemental.

Read ["TDD is Dead. Long Live Testing"](http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live-testing.html) by DHH for an anti-TDD viewpoint
Expand All @@ -218,7 +221,7 @@ Read ["TDD is Dead. Long Live Testing"](http://david.heinemeierhansson.com/2014/

This section contains questions for you to check your understanding of this lesson. If you’re having trouble answering the questions below on your own, review the material above to find the answer.

- What does it mean for code to be test **driven**?
- List four different advantages of TDD.
- What is the 3 part development cycle used for TDD?
- How much code should be written when going from the `red` state to the `green` state of the red-green-refactor cycle?
- [What does it mean for code to be test **driven**?](#what-is-tdd-and-why-do-it)
- [List four different advantages of TDD](#what-is-tdd-and-why-do-it)
- [What is the 3 part development cycle used for TDD?](#what-is-tdd-and-why-do-it)
- [How much code should be written when going from the `red` state to the `green` state of the red-green-refactor cycle?](#what-is-tdd-and-why-do-it)
Comment on lines +224 to +227
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having link backs in the Knowledge Check section is good, but if they all point to the same section, then they might cause confusion when they all end up at the same place.

Additionally, you've missed a period at the end of the second check.

Loading