Sha256: ae5d8d831f9d200c6f33d7f6bde1e8ed8cf64b20dfb205926f6a9d688e5dc4f4

Contents?: true

Size: 810 Bytes

Versions: 4

Compression:

Stored size: 810 Bytes

Contents

require 'spec_helper'

describe 'Rosebud::Validations::PresenceValidator' do
  it 'should raise an error if value is nil' do
    expect { Rosebud::Validations::PresenceValidator.new.validate_param(:param, nil, true) }.to raise_error(Errawr::Error)
  end
  
  it 'should raise an error if value is blank' do
    expect { Rosebud::Validations::PresenceValidator.new.validate_param(:param, '', true) }.to raise_error(Errawr::Error)
  end
  
  it 'should raise an error if value is whitespace' do
    expect { Rosebud::Validations::PresenceValidator.new.validate_param(:param, ' ', true) }.to raise_error(Errawr::Error)
  end
  
  it 'should not raise an error if value is not blank' do
    expect { Rosebud::Validations::PresenceValidator.new.validate_param(:param, 'Anthony', true) }.not_to raise_error
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rosebud-0.2.0 spec/presence_validator_spec.rb
rosebud-0.1.2 spec/presence_validator_spec.rb
rosebud-0.1.1 spec/presence_validator_spec.rb
rosebud-0.1.0 spec/presence_validator_spec.rb