Skip to content

Commit

Permalink
improve describe
Browse files Browse the repository at this point in the history
  • Loading branch information
glaucocustodio committed Dec 20, 2024
1 parent 7cfb941 commit a471e46
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
30 changes: 29 additions & 1 deletion _includes/describe.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,35 @@ <h2 id="describe-what-you-are-testing">
{% endhighlight %}
</div>

<p>In request tests, describe the controller constant and its actions.</p>
<h3 id="describe-request-tests">
<a href="#describe-request-tests">
Describing request tests
</a>
</h3>

<p>In request tests, describe the controller constant and its actions so one can easily spot what is being tested.</p>

<div class="bad">
{% highlight ruby %}
describe UsersController, type: :request do
describe 'GET #index' do
it 'returns a successful response' do
get users_url

expect(response.code).to eq('200')
end
end

describe 'POST /users' do
it 'creates a user' do
post users_url, params: { user: { name: 'Tom Jobim' } }

expect(User.last.name).to eq('Tom Jobim')
end
end
end
{% endhighlight %}
</div>

<div class="good">
{% highlight ruby %}
Expand Down
3 changes: 2 additions & 1 deletion _sass/custom/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
margin-bottom: 4em;
}

h2 {
h2,
h3 {
&:first-child {
margin-top: 0;
}
Expand Down

0 comments on commit a471e46

Please sign in to comment.