Add some method aliases

This commit is contained in:
Lee Reilly 2013-05-27 21:08:32 -07:00
parent 97467c9958
commit f0678c2fba
2 changed files with 7 additions and 0 deletions

View File

@ -151,6 +151,7 @@ module Swot
return false
end
end
alias_method :academic?, :is_academic?
# Figure out the institution name based on the email address/domain.
#
@ -162,6 +163,7 @@ module Swot
domain = PublicSuffix.parse(text)
name_from_academic_domain(domain)
end
alias_method :school_name, :get_institution_name
# Figure out if a domain name is a know academic institution.
#

View File

@ -47,4 +47,9 @@ class TestEmail < Test::Unit::TestCase
should "returns name of valid institution" do
assert_equal Swot::get_institution_name('lreilly@cs.strath.ac.uk'), "University of Strathclyde"
end
should "test aliased methods" do
assert_equal Swot::academic?('stanford.edu'), true
assert_equal Swot::school_name('lreilly@cs.strath.ac.uk'), "University of Strathclyde"
end
end