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

Tradução do tópico 17.1 : Recursos de testes adicionais #764

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 9 additions & 9 deletions pt-BR/testing.md
Original file line number Diff line number Diff line change
@@ -2030,25 +2030,25 @@ RSpec.describe "Zeitwerk compliance" do
end
```

Additional Testing Resources
Recursos de teste adicionais
----------------------------

### Testing Time-Dependent Code
### Testando código Time-Dependent

Rails provides built-in helper methods that enable you to assert that your time-sensitive code works as expected.
O Rails fornece métodos auxiliares integrados que permitem garantir que seu código time-sensitive funciona conforme o esperado.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
O Rails fornece métodos auxiliares integrados que permitem garantir que seu código time-sensitive funciona conforme o esperado.
O Rails fornece métodos auxiliares integrados que permitem garantir que seu código temporal funcione conforme o esperado.

Fiquei pensando aqui em uma tradução de contexto para time-sensitive. Será que temporal faz sentido, pois remete a algo ser transitório ao longo do tempo? O que acham? @weslleymurdock @campuscode/guia-rails-team


Here is an example using the [`travel_to`](https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html#method-i-travel_to) helper:
Aqui está um exemplo utilizando o helper [`travel_to`](https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html#method-i-travel_to):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Aqui está um exemplo utilizando o helper [`travel_to`](https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html#method-i-travel_to):
Aqui está um exemplo utilizando o _helper_ [`travel_to`](https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html#method-i-travel_to):


```ruby
# Lets say that a user is eligible for gifting a month after they register.
# Digamos que um usuário seja elegível para presentear um mês depois de se registrar.
user = User.create(name: "Gaurish", activation_date: Date.new(2004, 10, 24))
assert_not user.applicable_for_gifting?
travel_to Date.new(2004, 11, 24) do
assert_equal Date.new(2004, 10, 24), user.activation_date # inside the `travel_to` block `Date.current` is mocked
assert_equal Date.new(2004, 10, 24), user.activation_date # dentro do bloco `travel_to`, `Date.current` é simulado
assert user.applicable_for_gifting?
end
assert_equal Date.new(2004, 10, 24), user.activation_date # The change was visible only inside the `travel_to` block.
assert_equal Date.new(2004, 10, 24), user.activation_date # A mudança era visível apenas dentro do bloco `travel_to`.
```

Please see [`ActiveSupport::Testing::TimeHelpers` API Documentation](https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html)
for in-depth information about the available time helpers.
Por favor veja a documentação da API [`ActiveSupport::Testing::TimeHelpers`](https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html)
para obter informações detalhadas sobre os time helpers disponíveis.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
para obter informações detalhadas sobre os time helpers disponíveis.
para obter informações detalhadas sobre os _time helpers_ disponíveis.