Skip to content

Instantly share code, notes, and snippets.

@riethmayer
Created February 2, 2010 00:03
Show Gist options
  • Save riethmayer/292203 to your computer and use it in GitHub Desktop.
Save riethmayer/292203 to your computer and use it in GitHub Desktop.
# 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