Permalink
Browse files

added intitial event date functionality

  • Loading branch information...
JonKernPA committed Apr 20, 2011
1 parent 23932e9 commit 40e9679de477a96717209b8c9e1c15715bedc006
@@ -1,7 +1,11 @@
+require 'rubygems'
+require 'mongo_mapper'
+
class Event
include MongoMapper::Document
key :title, :required => true
+ key :date, Time, :default => Time.now
key :user_id
belongs_to :user
@@ -1,3 +1,6 @@
+require 'rubygems'
+require 'mongo_mapper'
+
class User
include MongoMapper::Document
@@ -0,0 +1,3 @@
+##### MONGODB SETTINGS #####
+MongoMapper.connection = Mongo::Connection.new('localhost', 27017, :pool_size => 5)
+MongoMapper.database = "event-development"
@@ -0,0 +1,10 @@
+Feature: Events are date-specific activities that are owned by a User.
+ Users can also register to attend events, or note their interest and like
+ of events.
+
+Scenario: Create an Event
+ Given A User "Fred"
+ When "Fred" creates "CodeRetreat Philly" on "06/01/2011"
+ Then We should see the "CodeRetreat Philly" event
+ And it should be owned by "Fred"
+ And it should be on "06/01/2011"
@@ -0,0 +1,23 @@
+Given /^A User "([^"]*)"$/ do |user_name|
+ user = User.create(:name => user_name)
+end
+
+When /^"([^"]*)" creates "([^"]*)" on "([^"]*)"$/ do |user_name, title, date|
+ author = User.find_by_name(user_name)
+ event = Event.create(:user => author, :title => title, :date => date)
+end
+
+Then /^We should see the "([^"]*)" event$/ do |title|
+ @event = Event.where(:title => title).first
+ @event.should_not be_nil
+end
+
+Then /^it should be owned by "([^"]*)"$/ do |user_name|
+ author = User.find_by_name(user_name)
+ @event.user.should == author
+end
+
+Then /^it should be on "([^"]*)"$/ do |date|
+ @event.date.strftime("%m/%d/%Y").should == date
+end
+
@@ -0,0 +1,4 @@
+$LOAD_PATH << File.expand_path('../../../app/model' , __FILE__)
+require 'user'
+require 'event'
+load 'config/mongo_db.rb'
@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>currentDocument</key>
+ <string>README.markdown</string>
<key>documents</key>
<array>
<dict>
@@ -11,16 +13,109 @@
<string>user_event</string>
<key>regexFolderFilter</key>
<string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
- <key>selected</key>
- <true/>
<key>sourceDirectory</key>
<string></string>
</dict>
</array>
<key>fileHierarchyDrawerWidth</key>
<integer>326</integer>
<key>metaData</key>
- <dict/>
+ <dict>
+ <key>README.markdown</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>0</integer>
+ <key>line</key>
+ <integer>114</integer>
+ </dict>
+ <key>firstVisibleColumn</key>
+ <integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>82</integer>
+ </dict>
+ <key>app/model/event.rb</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>16</integer>
+ <key>line</key>
+ <integer>28</integer>
+ </dict>
+ <key>firstVisibleColumn</key>
+ <integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>14</integer>
+ </dict>
+ <key>app/model/user.rb</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>20</integer>
+ <key>line</key>
+ <integer>31</integer>
+ </dict>
+ <key>firstVisibleColumn</key>
+ <integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>0</integer>
+ </dict>
+ <key>spec/event_spec.rb</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>0</integer>
+ <key>line</key>
+ <integer>80</integer>
+ </dict>
+ <key>firstVisibleColumn</key>
+ <integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>46</integer>
+ </dict>
+ <key>spec/user_spec.rb</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>0</integer>
+ <key>line</key>
+ <integer>63</integer>
+ </dict>
+ <key>columnSelection</key>
+ <false/>
+ <key>firstVisibleColumn</key>
+ <integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>30</integer>
+ <key>selectFrom</key>
+ <dict>
+ <key>column</key>
+ <integer>0</integer>
+ <key>line</key>
+ <integer>59</integer>
+ </dict>
+ <key>selectTo</key>
+ <dict>
+ <key>column</key>
+ <integer>0</integer>
+ <key>line</key>
+ <integer>63</integer>
+ </dict>
+ </dict>
+ </dict>
+ <key>openDocuments</key>
+ <array>
+ <string>app/model/event.rb</string>
+ <string>spec/event_spec.rb</string>
+ <string>README.markdown</string>
+ <string>app/model/user.rb</string>
+ <string>spec/user_spec.rb</string>
+ </array>
<key>showFileHierarchyDrawer</key>
<false/>
<key>windowFrame</key>

0 comments on commit 40e9679

Please sign in to comment.