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.
This commit is contained in:
Javi Martín
2019-09-25 19:46:24 +02:00
parent 55c4a953ea
commit 4ead96b666

View File

@@ -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