From 7c4597c27fb0cd29f5e7d39049c2fd8e8267f8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Glauco=20Cust=C3=B3dio?= Date: Tue, 6 Aug 2024 21:32:30 +0100 Subject: [PATCH] add redundant require article --- _config.yml | 5 ++++- _includes/redundant_require.html | 35 ++++++++++++++++++++++++++++++++ index.html | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 _includes/redundant_require.html diff --git a/_config.yml b/_config.yml index 6d9e9c4..077d8ac 100644 --- a/_config.yml +++ b/_config.yml @@ -1,5 +1,5 @@ title: Even Better Specs -description: Guidelines for readable and maintainable tests +description: Guidelines for maintainable tests theme: just-the-docs url: https://evenbetterspecs.github.io @@ -42,6 +42,9 @@ nav_external_links: - title: Expect vs should url: "#expect-vs-should" hide_icon: true + - title: Redundant require + url: "#redundant-require" + hide_icon: true - title: Instance double over double url: "#instance-double-over-double" hide_icon: true diff --git a/_includes/redundant_require.html b/_includes/redundant_require.html new file mode 100644 index 0000000..f671911 --- /dev/null +++ b/_includes/redundant_require.html @@ -0,0 +1,35 @@ +
+

+ + Redundant require + +

+ +

Avoid redundant require in your spec files. Use .rspec file instead.

+ +
+{% highlight ruby %} +# spec/models/user_spec.rb +require 'rails_helper' + +describe User do +end +{% endhighlight %} +
+ +
+{% highlight ruby %} +# spec/models/user_spec.rb +describe User do +end +{% endhighlight %} +
+ +
+{% highlight ruby %} +# .rspec +--require rails_helper +{% endhighlight %} +
+ +
\ No newline at end of file diff --git a/index.html b/index.html index 3e910d4..2be0fbb 100644 --- a/index.html +++ b/index.html @@ -35,6 +35,7 @@

{% include all_possible_cases.html %} {% include request_vs_controller.html %} {% include expect_vs_should.html %} +{% include redundant_require.html %} {% include instance_double_over_double.html %} {% include lets_not.html %} {% include avoid_hooks.html %}