Skip to content

Commit

Permalink
Remove more fixture dependencies. [#22]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed May 8, 2009
1 parent 3eb6982 commit 8361196
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 4 additions & 0 deletions spec/blueprints.rb
Expand Up @@ -24,6 +24,8 @@
end

User.blueprint do
firstname
lastname
email
password
password_confirmation {self.password}
Expand All @@ -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
Expand Down
22 changes: 9 additions & 13 deletions 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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8361196

Please sign in to comment.