From cc85664352bc129e8023644598ebefd1fa2c05db Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Wed, 29 Aug 2018 10:12:24 +0200 Subject: [PATCH 1/2] controller specs subject naming convention --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index baf1229..1c10cc9 100644 --- a/README.md +++ b/README.md @@ -79,17 +79,18 @@ long_line_under_100_chars - Use the following as a rule of thumb for context setup. If you can't follow it, stop for a second and think about your object's API, maybe the problem is there. ```ruby -# after describe the first is always the subject +# after describe the first is always the subject, called the same as the described method. +# For controller specs use get_index, get_show, patch_update, post_create, delete_destroy, etc. describe "#foo" subject(:foo) { bar.foo } - # then lets follow in the order they will be called when subject is invoked + # then "let"s follow in the order they will be called when subject is invoked let(:bar) { Bar.new(baz, qux) } let(:baz) { build :baz, cruz: cruz } let(:cruz) { build :cruz } let(:gux) { build :gux, cruz: cruz } - # let! follows with their lets + # "let!" follows with their "let"s let!(:corge) { create :corge, grault: grault } let(:grault) { create :grault } let!(:garply) { create :garply, grault: grault } From 3de1f8737c9230d6df92e66ffc2187ac4e9bda91 Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Thu, 30 Aug 2018 17:01:03 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1c10cc9..1b54260 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ long_line_under_100_chars # Extra Specs Coding Style - Add a blank line between `let` and `before`. +- Prefer `ModelKlass.new` over `build_stubbed` over `build` over `create` for optimal performance. - Use the following as a rule of thumb for context setup. If you can't follow it, stop for a second and think about your object's API, maybe the problem is there. ```ruby