Created
February 2, 2010 00:03
-
-
Save riethmayer/292203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# name_spec.rb ;; 2010 (cc) Jan Riethmayer | |
# This work is licensend under a Creative Commons Attribution 3.0 license. | |
require "spec_helper" | |
describe "Name" do | |
it "should contain all prefixes" do | |
Name.parts.each do |part| | |
Name.compute.any? do |name| | |
name.match(/^#{part.capitalize}/) | |
end.should == true | |
end | |
end | |
it "should contain all suffixes" do | |
Name.parts.each do |part| | |
Name.compute.any? do |name| | |
name.match(/#{part}$/) | |
end.should == true | |
end | |
end | |
it "should be unique names" do | |
Name.compute.size.should == Name.compute.uniq.size | |
end | |
it "should be sorted" do | |
Name.compute.sort.zip(Name.compute).each do |sorted, expected| | |
sorted.should == expected | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment