Skip to content

Commit

Permalink
Update Ruby tests
Browse files Browse the repository at this point in the history
- Add instructions to run tests
- Ensure minitest is a development dependency
- Add tests for blank emails
  • Loading branch information
owst committed Mar 18, 2016
1 parent b4f0fa6 commit 187844f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions ruby-mailchecker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Gem::Specification.new do |spec|

spec.files = ['platform/ruby/mail_checker.rb', 'platform/ruby/ruby-mailchecker.rb']
spec.require_paths = ['platform/ruby']
spec.add_development_dependency 'minitest'
end
8 changes: 6 additions & 2 deletions test/platform.ruby.test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Run tests from the repository root directory:
# $ bundle install && bundle exec ruby test/platform.ruby.test.rb
require 'minitest/autorun'

require_relative '../platform/ruby/mail_checker'

class TestMailChecker < MiniTest::Unit::TestCase
class TestMailChecker < MiniTest::Test
def valid!(email)
assert_equal true, MailChecker(email)
end
Expand All @@ -21,13 +23,15 @@ def test_return_true_if_valid
end

def test_return_false_if_email_invalid
invalid!('')
invalid!(' ')
invalid!('plopplop.com')
invalid!('my+ok@ok=plop.com')
invalid!('my,ok@ok.plop.com')
invalid!('ok@tmail.com')
end

def test_return_false_if_throwable_domain
invalid!('ok@tmail.com')
invalid!('ok@33mail.com')
invalid!('ok@ok.33mail.com')
invalid!('ok@guerrillamailblock.com')
Expand Down

0 comments on commit 187844f

Please sign in to comment.