Introduction to RSpec: Fix all top level "describe" blocks to "Rspec.describe"#30997
Conversation
| ``` | ||
|
|
||
| <span id='keyword-it'>The `it` keyword defines an individual example (aka, test)</span>. `it` takes a string argument and is also passed a block. This block is where our expectations of a method are expressed. In this particular case, when we pass 5 and 2 to the `#add` method, we expect it to return 7. This is concisely expressed in our expectation clause, which uses one of [RSpec's equality matchers](http://rspec.info/features/3-12/rspec-expectations/built-in-matchers/equality/), `eql`: | ||
| While both syntax are valid, stick to `Rspec.describe` for now. Anyway, <span id='keyword-it'>the `it` keyword defines an individual example (aka, test)</span>. `it` takes a string argument and is also passed a block. This block is where our expectations of a method are expressed. In this particular case, when we pass 5 and 2 to the `#add` method, we expect it to return 7. This is concisely expressed in our expectation clause, which uses one of [RSpec's equality matchers](http://rspec.info/features/3-12/rspec-expectations/built-in-matchers/equality/), `eql`: |
There was a problem hiding this comment.
While both syntax are valid, stick to
Rspec.describefor now.
Nit: Because we're recommending that learners don't use it. What do you think about removing the the second example that shows the describe without the RSpec prefix? does it muddy the water and make things harder to understand?
There was a problem hiding this comment.
@KevinMulhern Now that you mention it, I don't think it does for the following reasons:
- We did say we want users to use RSpec with its module name without explaining why and some folks might feel strongly to question this, which is a fair concern, and someone will have to explain it on Discord again
- It really is an either or option, to use or not to use the module name (Hamlet intended yes) would probably not matter too much for the kind of tests learners will be writing within TOP, both on the Ruby and Rails course. I've never worked with Ruby extensively before so I am not sure if there is any point in which learners will have to research about monkey-patching like you mentioned in this comment of yours. Anyhow, in the spirit of "conventions over configuration" and trusting learners will be able to research their way out, I think it's okay to remove the second example
There was a problem hiding this comment.
Those sounds like solid reasons to me! would you like to remove it in this PR?
There was a problem hiding this comment.
@KevinMulhern I'll get that done in a flash!
| project | ||
| |__lib | ||
| | |__script.rb | ||
| | |__calculator.rb |
KevinMulhern
left a comment
There was a problem hiding this comment.
Thanks for doing this @ZackHoang, this lesson is looking way better 💪
Because
Currently, this lesson is mistakenly introducing the top level
describeblock twices. This PR re-introduces theRspec.describesyntax to be explicit about how RSpec tests should be written.This PR
describeblocks toRSpec.describeIssue
Closes #30988
Additional Information
Pull Request Requirements
location of change: brief description of changeformat, e.g.Intro to HTML and CSS lesson: Fix link textBecausesection summarizes the reason for this PRThis PRsection has a bullet point list describing the changes in this PRIssuesection