Sha256: 6fc6e921a1332424bca4b3a5cc0821f80781e31561efbc5e72901f03af832682
Contents?: true
Size: 798 Bytes
Versions: 2
Compression:
Stored size: 798 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe HostNameValidator do let(:server) { Server.new } context 'when host_name is invalid' do before do server.host_name = 'http://' server.valid? end it 'sets object as invalid' do expect(server).not_to be_valid end it 'sets an error' do expect(server.errors[:host_name]).to eq(['is invalid']) end end context 'when host_name is valid' do before do server.host_name = 'bd01' server.valid? end it 'sets object as valid' do expect(server).to be_valid end it 'does not set an error on attribute' do expect(server.errors[:host_name]).to be_blank end end it 'is valid with a nil value' do expect(server).to be_valid end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_host-1.3.0 | spec/validates_host/host_name_validator_spec.rb |
validates_host-1.2.0 | spec/validates_host/host_name_validator_spec.rb |