Skip to content

Commit

Permalink
Fix .first_name in Forgery::Name (this is why we test)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Sutton committed Sep 4, 2011
1 parent 78dd670 commit b3093ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/forgery/forgery/name.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.last_name
end end


def self.first_name def self.first_name
[dictionaries[:male_first_names], dictionaries[:female_first_names]].random.random.unextend Forgery::Extend(dictionaries[:male_first_names] + dictionaries[:female_first_names]).random.unextend
end end


def self.full_name def self.full_name
Expand Down
7 changes: 7 additions & 0 deletions spec/forgery/name_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,11 @@
require 'spec_helper' require 'spec_helper'


describe Forgery::Name do describe Forgery::Name do
it "should return a random first name" do
(Forgery.dictionaries[:male_first_names] + Forgery.dictionaries[:female_first_names]).should include(Forgery::Name.first_name)
end

it "should return a random last name" do
Forgery.dictionaries[:last_names].should include(Forgery::Name.last_name)
end
end end

0 comments on commit b3093ff

Please sign in to comment.