Skip to content

Commit

Permalink
Start faking users. [#22]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed May 8, 2009
1 parent 2e701ef commit 3eb6982
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions spec/blueprints.rb
Expand Up @@ -11,21 +11,29 @@
State.blueprint do
country {Country.make}
name {Sham.generic_name}
code {Sham.code}
code
end

Country.blueprint do
name {Sham.generic_name}
code {Sham.code}
code
end

Calendar.blueprint do
name {Sham.calendar_name}
end

User.blueprint do
email
password
password_confirmation {self.password}
end

Sham.define do
calendar_name {Faker::Name.name + "'s calendar"}
email {Faker::Internet.email}
generic_name {Faker::Name.last_name}
password {(1..(rand(15) + 2)).map{(32..127).to_a.rand.chr}.join}
code {LETTERS.rand + LETTERS.rand} # 2 random letters
event_name {Faker::Lorem.words(3).join(' ')}
end
2 changes: 1 addition & 1 deletion spec/helpers/events_helper_spec.rb
Expand Up @@ -52,7 +52,7 @@
end

it "should generate a distance string from an event to a user's coords," do
marnen = users(:marnen)
marnen = User.make(:coords => Point.from_x_y(5, 10)) # arbitrary coordinates
@event.coords = marnen.coords
helper.distance_string(@event, marnen).should =~ /\D\d(\.\d+)? miles/
user = User.new
Expand Down

0 comments on commit 3eb6982

Please sign in to comment.