Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
j_platform / spec / models / resolution_spec.rb
Size: Mime:
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