From 6b1a1834ad1715145f047790c8391b8a5558bece Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 20 Dec 2023 20:34:25 +0000 Subject: Created new Operation model and fixed Event associations with it --- spec/models/operation_spec.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec/models/operation_spec.rb (limited to 'spec/models/operation_spec.rb') diff --git a/spec/models/operation_spec.rb b/spec/models/operation_spec.rb new file mode 100644 index 0000000..a46a528 --- /dev/null +++ b/spec/models/operation_spec.rb @@ -0,0 +1,33 @@ +require 'rails_helper' + +RSpec.describe Operation, type: :model do + let(:organisation) { + org = build(:organisation) + # Operation.create!( + # name: "MyString" + # ) + } + + # before(:each) do + # assign(:operation, operation) + # end + subject { described_class.new(name: "Spuds", organisation: organisation) } + + describe "existence" do + it "exists!" do + expect(subject).to be_valid + end + end + + describe "validations" do + it "is invalid without a name" do + subject.name = nil + expect(subject).to be_invalid + end + + it "is invalid with a name longer than 35 chars" do + subject.name = "a" * 36 + expect(subject).to be_invalid + end + end +end -- cgit v1.2.3