blob: 6c59f21128c0ae6f04afc585f6bbe93e29dbfbd3 (
plain) (
tree)
|
|
require 'rails_helper'
RSpec.describe Operation, type: :model do
let(:organisation) {
build(:organisation)
# Operation.create!(
# name: "MyString"
# )
}
# before(:each) do
# assign(:operation, operation)
# end
subject { described_class.new(name: "Spuds", organisation: organisation) }
describe "associations" do
it { should belong_to(:organisation).class_name('Organisation') }
end
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
|