Repository URL to install this package:
Version:
2.23.0 ▾
|
require 'spec_helper'
describe JPlatform::Ticket::Resolution, :type => :model do
describe "validation" do
it "is not valid without a name" do
subject.name = nil
subject.valid?
expect(subject.errors[:name].size).to eq(1)
end
it "is not valid with a very long name" do
subject.name = "Z"*100
subject.valid?
expect(subject.errors[:name].size).to eq(1)
end
it "is not valid without a code" do
subject.code = nil
subject.valid?
expect(subject.errors[:code].size).to eq(1)
end
it "is not valid if code is too long" do
subject.code = "X"*30
subject.valid?
expect(subject.errors[:code].size).to eq(1)
end
end
describe "to_s string" do
it "contains the code and the name" do
subject.code = '002'
subject.name = 'Does not compute'
expect(subject.to_s).to include (subject.name and subject.code)
end
end
end