Skip to content

Commit

Permalink
Added a few starter specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiety committed Oct 13, 2010
1 parent b189dcc commit 8bd0f70
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
20 changes: 17 additions & 3 deletions spec/nameable_spec.rb
@@ -1,7 +1,21 @@
require File.dirname(__FILE__) + '/spec_helper'

describe "nameable" do
it "should do nothing" do
true.should == true
describe Nameable::Latin do
describe "with 'Mr. Chris Horn PhD" do
subject { Nameable::Latin.new.parse("Mr. Chris Horn PhD") }

it("should extract prefix") { subject.prefix.should == "Mr." }
it("should extract first name") { subject.first.should == "Chris" }
it("should extract last name") { subject.last.should == "Horn" }
it("should extract and normalize suffix") { subject.suffix.should == "Ph.D." }
end

describe "with 'Chris Old Biscuit Barrel Horn'" do
subject { Nameable::Latin.new.parse("Chris Old Biscuit Barrel Horn") }

it("should extract first name") { subject.first.should == "Chris" }
it("should extract middle name") { subject.middle.should == "Old Biscuit Barrel" }
it("should extract last name") { subject.last.should == "Horn" }
end

end
5 changes: 5 additions & 0 deletions spec/spec.opts
@@ -0,0 +1,5 @@
--colour
--format nested
--loadby mtime
--reverse
--backtrace
12 changes: 10 additions & 2 deletions spec/spec_helper.rb
@@ -1,2 +1,10 @@
$TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
$LOAD_PATH.push File.join(File.dirname(__FILE__), '..', 'lib')

require "rubygems"
require "spec"
require "active_support"
require "nameable"

Spec::Runner.configure do |config|
# config.mock_with :mocha
end

0 comments on commit 8bd0f70

Please sign in to comment.