From b0c95c8066fb5753462229882a721f590453661a Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 20 Dec 2023 15:24:57 +0000 Subject: Refactors existing organisation model spec --- spec/models/organisation_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 090cdc2..e21c40c 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -1,16 +1,18 @@ require 'rails_helper' RSpec.describe Organisation, type: :model do + + subject = Organisation.new(name: "Hollander Property") + describe "validations" do it "is invalid if no name given" do - org = Organisation.new() - expect(org).to_not be_valid + subject.name = nil + expect(subject).to_not be_valid end it "is invalid with a name longer than 25 chars" do - name = "a" * 26 - org = Organisation.new(name: name) - expect(org).to_not be_valid + subject.name = "a" * 26 + expect(subject).to_not be_valid end end end -- cgit v1.2.3