generated from just-the-docs/just-the-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
032312b
commit b9cffba
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<article> | ||
<h2 id="stub-environment-variables"> | ||
<a href="#stub-environment-variables"> | ||
Stub environment variables | ||
</a> | ||
</h2> | ||
|
||
<p>Stub environment variables your code requires so your tests become more self-contained, the <a href="https://rubygems.org/gems/stub_env" target="_blank">stub_env</a> gem might help you with that.</p> | ||
|
||
<div class="example"> | ||
{% highlight ruby %} | ||
def notify_sales_team | ||
mail( | ||
to: ENV['SALES_TEAM_EMAIL'], | ||
subject: 'New sale' | ||
) | ||
end | ||
{% endhighlight %} | ||
</div> | ||
|
||
<div class="bad"> | ||
{% highlight ruby %} | ||
describe '#notify_sales_team' do | ||
it 'prepares the email' do | ||
subject = described_class.notify_sales_team | ||
|
||
expect(subject.to).to eq(['[email protected]']) | ||
expect(subject.subject).to eq('New sale') | ||
end | ||
end | ||
{% endhighlight %} | ||
</div> | ||
|
||
<div class="bad"> | ||
{% highlight ruby %} | ||
# .env.test | ||
SALES_TEAM_EMAIL='[email protected]' | ||
{% endhighlight %} | ||
</div> | ||
|
||
<div class="good"> | ||
{% highlight ruby %} | ||
describe '#notify_sales_team' do | ||
it 'prepares the email' do | ||
stub_env('SALES_TEAM_EMAIL', '[email protected]') | ||
|
||
subject = described_class.notify_sales_team | ||
|
||
expect(subject.to).to eq(['[email protected]']) | ||
expect(subject.subject).to eq('New sale') | ||
end | ||
end | ||
{% endhighlight %} | ||
</div> | ||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters