Sha256: 0f1f3f015b9fc0f8335459bf69282964f31df460bf07dbbd3614bc55f1e66fc7
Contents?: true
Size: 819 Bytes
Versions: 2
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe DomainNameValidator do let(:server) { Server.new } context 'when domain_name is invalid' do before do server.domain_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[:domain_name]).to eq(['is invalid']) end end context 'when domain_name is valid' do before do server.domain_name = 'example.com' 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[:domain_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/domain_name_validator_spec.rb |
validates_host-1.2.0 | spec/validates_host/domain_name_validator_spec.rb |