Train-driven development 🚋

This commit is contained in:
Lee Reilly 2012-02-04 15:02:11 -08:00
parent 5eb93c54c4
commit f99097d728
2 changed files with 35 additions and 23 deletions

View File

@ -1,17 +1,21 @@
Swot allows you to figure out whether a particular email address or domain
is associated with an academic institution providing higher education in
tertiary, quaternary and post-secondary education.
tertiary, quaternary or post-secondary education in any country in the
world.
== Email addresses belonging to academic institutions
**What is a swot?** [UrbanDictionary will fill you in](http://www.urbandictionary.com/define.php?term=swot) ಠ_ಠ
Swot::academic?('lreilly@stanford.edu') # true
Swot::academic?('lreilly@slac.stanford.edu') # true
Swot::academic?('lreilly@strath.ac.uk') # true
Swot::academic?('lreilly@soft-eng.strath.ac.uk') # true
Swot::academic?('lee@ugr.es') # true
Swot::academic?('lee@uottawa.ca') # true
== Usage
== Email addresses not belonging to academic institutions
Swot::academic?('lreilly@stanford.edu') # true
Swot::academic?('lreilly@slac.stanford.edu') # true
Swot::academic?('lreilly@strath.ac.uk') # true
Swot::academic?('lreilly@soft-eng.strath.ac.uk') # true
Swot::academic?('lee@ugr.es') # true
Swot::academic?('lee@uottawa.ca') # true
Swot::academic?('harvard.edu') # true
Swot::academic?('www.harvard.edu') # true
Swot::academic?('http://www.harvard.edu') # true
Swot::academic?('lee@leerilly.net') # false
Swot::academic?('lee@gmail.com') # false
@ -30,7 +34,12 @@ tertiary, quaternary and post-secondary education.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
== Known Issues / Bugs
== Known Issues /
* You can search by email and domain names only. You cannot search by IP.
* Can't handle port numbers yet.
![](https://a248.e.akamai.net/assets.github.com/img/e3700efc05ca611162b365367aadc8b112b4969d/687474703a2f2f692e696d6775722e636f6d2f4b387673772e676966)
== Copyright

View File

@ -1,7 +1,7 @@
require 'helper'
class TestEmail < Test::Unit::TestCase
should "know what a valid acadmic institution email address or domain is" do
should "work with all the things" do
assert_equal Swot::is_academic?('lreilly@stanford.edu'), true
assert_equal Swot::is_academic?('lreilly@slac.stanford.edu'), true
assert_equal Swot::is_academic?('lreilly@strath.ac.uk'), true
@ -16,19 +16,22 @@ class TestEmail < Test::Unit::TestCase
assert_equal Swot::is_academic?('lee@stanford.edu.com'), false
assert_equal Swot::is_academic?('lee@strath.ac.uk.com'), false
assert_equal Swot::is_academic?('stanford.edu'), true
assert_equal Swot::is_academic?('slac.stanford.edu'), true
assert_equal Swot::is_academic?('strath.ac.uk'), true
assert_equal Swot::is_academic?('soft-eng.strath.ac.uk'), true
assert_equal Swot::is_academic?('ugr.es'), true
assert_equal Swot::is_academic?('uottawa.ca'), true
assert_equal Swot::is_academic?('mother.edu.ru'), true
assert_equal Swot::is_academic?('ucy.ac.cy'), true
assert_equal Swot::is_academic?('stanford.edu'), true
assert_equal Swot::is_academic?('slac.stanford.edu'), true
assert_equal Swot::is_academic?('www.stanford.edu'), true
assert_equal Swot::is_academic?('http://www.stanford.edu'), true
#assert_equal Swot::is_academic?('http://www.stanford.edu:9393'), true
assert_equal Swot::is_academic?('strath.ac.uk'), true
assert_equal Swot::is_academic?('soft-eng.strath.ac.uk'), true
assert_equal Swot::is_academic?('ugr.es'), true
assert_equal Swot::is_academic?('uottawa.ca'), true
assert_equal Swot::is_academic?('mother.edu.ru'), true
assert_equal Swot::is_academic?('ucy.ac.cy'), true
assert_equal Swot::is_academic?('leerilly.net'), false
assert_equal Swot::is_academic?('gmail.com'), false
assert_equal Swot::is_academic?('stanford.edu.com'), false
assert_equal Swot::is_academic?('strath.ac.uk.com'), false
assert_equal Swot::is_academic?('leerilly.net'), false
assert_equal Swot::is_academic?('gmail.com'), false
assert_equal Swot::is_academic?('stanford.edu.com'), false
assert_equal Swot::is_academic?('strath.ac.uk.com'), false
end
end