From 8361196338eda10f2e8e180d84a366cce6d70b4f Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 8 May 2009 16:49:21 -0400 Subject: [PATCH] Remove more fixture dependencies. [#22] --- spec/blueprints.rb | 4 ++++ spec/helpers/events_helper_spec.rb | 22 +++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/blueprints.rb b/spec/blueprints.rb index db7b917c..e326d509 100644 --- a/spec/blueprints.rb +++ b/spec/blueprints.rb @@ -24,6 +24,8 @@ end User.blueprint do + firstname + lastname email password password_confirmation {self.password} @@ -32,6 +34,8 @@ Sham.define do calendar_name {Faker::Name.name + "'s calendar"} email {Faker::Internet.email} + firstname {Faker::Name.first_name} + lastname {Faker::Name.last_name} 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 diff --git a/spec/helpers/events_helper_spec.rb b/spec/helpers/events_helper_spec.rb index 895033c7..e8865a6f 100644 --- a/spec/helpers/events_helper_spec.rb +++ b/spec/helpers/events_helper_spec.rb @@ -1,8 +1,6 @@ require File.dirname(__FILE__) + '/../spec_helper' describe EventsHelper do - fixtures :users, :states, :countries - before(:each) do @event = Event.make end @@ -41,14 +39,15 @@ end =end it "should generate a comma-separated list of names from an array of users" do + users = (1..5).map{User.make} names = helper.list_names users - for user in users do - names.should include(user.fullname) + users.each do |user| + names.should include(user.to_s) end end it "should get an attendance status for an event and a user" do - helper.attendance_status(@event, users(:quentin)).should == :maybe + helper.attendance_status(@event, User.make).should == :maybe end it "should generate a distance string from an event to a user's coords," do @@ -75,14 +74,12 @@ end describe EventsHelper, "event_map" do - fixtures :events, :states, :countries, :users, :states, :countries - before(:each) do - User.stub!(:current_user).and_return(users(:marnen)) + User.stub!(:current_user).and_return(User.make) end it "should set up a GMap with all the options" do - event = events(:one) + event = Event.make # TODO: since this code is now in events/map.js , translate these specs into JavaScript! =begin @@ -152,11 +149,10 @@ end describe EventsHelper, "rss_url" do - fixtures :users - it "should return the RSS feed URL for the current user" do - User.current_user = users(:marnen) - helper.rss_url.should == formatted_feed_events_url(:format => :rss, :key => users(:marnen).feed_key) + user = User.make + User.current_user = user + helper.rss_url.should == formatted_feed_events_url(:format => :rss, :key => user.feed_key) end it "should return nil if there is no current user" do