Skip to content

Commit

Permalink
Remove unused RFC gem
Browse files Browse the repository at this point in the history
* the RFC gem doesn't support ruby 3.3, but we don't seem to use it anyway
  • Loading branch information
sethboyles committed Nov 4, 2024
1 parent d84cd86 commit 1147984
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 51 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ gem 'public_suffix'
gem 'puma'
gem 'rake'
gem 'redis'
gem 'rfc822'
gem 'rubyzip', '>= 1.3.0'
gem 'sequel', '~> 5.85'
gem 'sequel_pg', require: 'sequel'
Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ GEM
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.9)
rfc822 (0.1.5)
roodi (5.0.0)
ruby_parser (~> 3.2, >= 3.2.2)
rspec (3.13.0)
Expand Down Expand Up @@ -651,7 +650,6 @@ DEPENDENCIES
railties (~> 7.2.1)
rake
redis
rfc822
roodi
rspec (~> 3.13.0)
rspec-collection_matchers
Expand Down
7 changes: 0 additions & 7 deletions lib/sequel_plugins/vcap_validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,5 @@ def validates_url(attr, opts={})

validates_format(URI::DEFAULT_PARSER.make_regexp(%w[http https]), attr, message: opts.fetch(:message, :url))
end

# Validates that an attribute is a valid email address
#
# @param [Symbol] The attribute to validate
def validates_email(attr)
validates_format(RFC822::EMAIL_REGEXP_WHOLE, attr, message: :email) if send(attr)
end
end
end
41 changes: 0 additions & 41 deletions spec/unit/lib/sequel_plugins/vcap_validations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,45 +63,4 @@ def self.define_validations(&)
end
end
end

describe 'validates_email' do
before do
@c.define_validations { validates_email(:val) }
end

it 'allows a valid email' do
@m.val = '[email protected]'
expect(@m).to be_valid
end

it 'does not allow an email with no domain' do
@m.val = 'some_guy'
expect(@m).not_to be_valid
end

it 'does not allow an email with no user' do
@m.val = '@somedomain.com'
expect(@m).not_to be_valid
end

it 'does not allow a malformed email with multiple @' do
@m.val = 'foo@[email protected]'
expect(@m).not_to be_valid
end

it 'allows a nil email' do
@m.val = nil
expect(@m).to be_valid
end

it 'does not allow an empty email' do
@m.val = ''
expect(@m).not_to be_valid
end

it 'does not allow an email with only spaces' do
@m.val = ' '
expect(@m).not_to be_valid
end
end
end

0 comments on commit 1147984

Please sign in to comment.