Sha256: e66f154506f8d96822af9e7cecb612cd819122f8995b62ea8861d7a0845f85f0

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

# encoding: utf-8

require "spec_helper"

describe Validatious::Validators::EmailValidator do
  
  before(:each) do
    Topic.validates_email_format_of(:email)
  end
  
  let(:topic) { Topic.new(:title => "The title", :email => "invalid email") }
  
  [
    'bob@bones.com',
    'bob.bones@bones.com'
  ].each do |email|
    describe email.inspect do
      it "should be valid" do
        topic.email = email
        topic.should be_valid
      end
    end
  end
  
  [nil, 1, "", " ", "email"].each do |email|
    describe email.inspect do
      it "should not be valid" do
        topic.email = email
        topic.should_not be_valid
      end
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validatious-0.4.0 spec/validatious/validators/email_validator_spec.rb
validatious-0.3.0 spec/validatious/validators/email_validator_spec.rb