From 4ead96b6663e8b9e2b6d02351fc83fc9f675deba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 25 Sep 2019 19:46:24 +0200 Subject: [PATCH] Use `let` only in the examples using the variables These variables were only used in the `validations` block; the rest of the tests re-defined them, making the code hard to follow. --- spec/models/poll/voter_spec.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spec/models/poll/voter_spec.rb b/spec/models/poll/voter_spec.rb index 1d7beed42..4c7e6dc62 100644 --- a/spec/models/poll/voter_spec.rb +++ b/spec/models/poll/voter_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe Poll::Voter do - - let(:poll) { create(:poll) } - let(:booth) { create(:poll_booth) } - let(:booth_assignment) { create(:poll_booth_assignment, poll: poll, booth: booth) } - let(:voter) { create(:poll_voter) } - describe "validations" do + let(:poll) { create(:poll) } + let(:booth) { create(:poll_booth) } + let(:booth_assignment) { create(:poll_booth_assignment, poll: poll, booth: booth) } + let(:voter) { create(:poll_voter) } let(:user) { create(:user, :level_two) } it "is valid" do