Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

pair programming: Event show

  • Loading branch information...
commit 515f6aa255e9a0d3d838d5da8207269a387c76fd 1 parent 6e4ac84
Glenn Goodrich authored October 07, 2011
18  Gemfile
... ...
@@ -1,20 +1,20 @@
1 1
 source 'http://rubygems.org'
2 2
 
3  
-gem 'rails', '3.1.0.rc5'
4  
-gem 'devise', "~> 1.4.2"
5  
-gem 'mongoid', "~> 2.1.8"
  3
+gem 'rails', '3.1.0'
  4
+gem 'devise', "~> 1.4.6"
  5
+gem 'mongoid', "~> 2.2.0"
6 6
 gem 'mongoid_spacial', "~> 0.2.13"
7 7
 gem 'haml', '~> 3.1.2'
8 8
 gem 'haml-rails', '~> 0.3.4'
9  
-gem 'bson_ext', '~> 1.3.1'
  9
+gem 'bson_ext', '~> 1.4.0'
10 10
 
11 11
 gem 'rails-backbone', "~> 0.5.3"
12 12
 
13 13
 # Gems used only for assets and not required
14 14
 # in production environments by default.
15 15
 group :assets do
16  
-  gem 'sass-rails', "~> 3.1.0.rc"
17  
-  gem 'coffee-rails', "~> 3.1.0.rc"
  16
+  gem 'sass-rails', "~> 3.1.0"
  17
+  gem 'coffee-rails', "~> 3.1.0"
18 18
   gem 'uglifier'
19 19
 end
20 20
 
@@ -23,14 +23,16 @@ gem 'jquery-rails'
23 23
 group :test, :development do
24 24
   gem 'rspec-rails', '~> 2.6.1'
25 25
   gem 'mongoid-rspec', '~> 1.4.4'
26  
-  gem 'capybara', '~> 1.0.1'
  26
+  gem 'capybara', '~> 1.1.1'
27 27
   gem 'factory_girl_rails', '~> 1.1.0'
28 28
   gem 'database_cleaner', '~> 0.6.7'
29 29
   gem 'jasmine', '~> 1.1.0.rc3'
30 30
   gem 'hpricot', '~> 0.8.4'
31 31
   gem 'ruby_parser', '~> 2.2.0'
32  
-  gem 'spork', '~> 0.9.0.rc'
  32
+  gem 'spork', '~> 0.9.0.rc9'
33 33
   gem 'launchy', '~> 2.0.5'
  34
+  gem 'guard-rspec', '~> 0.4.5'
  35
+  gem 'guard-spork', '~> 0.2.1'
34 36
 end
35 37
 
36 38
 # Use unicorn as the web server
142  Gemfile.lock
... ...
@@ -1,62 +1,60 @@
1 1
 GEM
2 2
   remote: http://rubygems.org/
3 3
   specs:
4  
-    actionmailer (3.1.0.rc5)
5  
-      actionpack (= 3.1.0.rc5)
  4
+    actionmailer (3.1.0)
  5
+      actionpack (= 3.1.0)
6 6
       mail (~> 2.3.0)
7  
-    actionpack (3.1.0.rc5)
8  
-      activemodel (= 3.1.0.rc5)
9  
-      activesupport (= 3.1.0.rc5)
  7
+    actionpack (3.1.0)
  8
+      activemodel (= 3.1.0)
  9
+      activesupport (= 3.1.0)
10 10
       builder (~> 3.0.0)
11 11
       erubis (~> 2.7.0)
12 12
       i18n (~> 0.6)
13  
-      rack (~> 1.3.1)
14  
-      rack-cache (~> 1.0.2)
15  
-      rack-mount (~> 0.8.1)
16  
-      rack-test (~> 0.6.0)
17  
-      sprockets (~> 2.0.0.beta.12)
18  
-    activemodel (3.1.0.rc5)
19  
-      activesupport (= 3.1.0.rc5)
20  
-      bcrypt-ruby (~> 2.1.4)
  13
+      rack (~> 1.3.2)
  14
+      rack-cache (~> 1.0.3)
  15
+      rack-mount (~> 0.8.2)
  16
+      rack-test (~> 0.6.1)
  17
+      sprockets (~> 2.0.0)
  18
+    activemodel (3.1.0)
  19
+      activesupport (= 3.1.0)
  20
+      bcrypt-ruby (~> 3.0.0)
21 21
       builder (~> 3.0.0)
22 22
       i18n (~> 0.6)
23  
-    activerecord (3.1.0.rc5)
24  
-      activemodel (= 3.1.0.rc5)
25  
-      activesupport (= 3.1.0.rc5)
26  
-      arel (~> 2.1.4)
  23
+    activerecord (3.1.0)
  24
+      activemodel (= 3.1.0)
  25
+      activesupport (= 3.1.0)
  26
+      arel (~> 2.2.1)
27 27
       tzinfo (~> 0.3.29)
28  
-    activeresource (3.1.0.rc5)
29  
-      activemodel (= 3.1.0.rc5)
30  
-      activesupport (= 3.1.0.rc5)
31  
-    activesupport (3.1.0.rc5)
  28
+    activeresource (3.1.0)
  29
+      activemodel (= 3.1.0)
  30
+      activesupport (= 3.1.0)
  31
+    activesupport (3.1.0)
32 32
       multi_json (~> 1.0)
33 33
     addressable (2.2.6)
34  
-    arel (2.1.4)
35  
-    bcrypt-ruby (2.1.4)
36  
-    bson (1.3.1)
37  
-    bson_ext (1.3.1)
  34
+    arel (2.2.1)
  35
+    bcrypt-ruby (3.0.1)
  36
+    bson (1.4.0)
  37
+    bson_ext (1.4.0)
38 38
     builder (3.0.0)
39  
-    capybara (1.0.1)
  39
+    capybara (1.1.1)
40 40
       mime-types (>= 1.16)
41 41
       nokogiri (>= 1.3.3)
42 42
       rack (>= 1.0.0)
43 43
       rack-test (>= 0.5.4)
44 44
       selenium-webdriver (~> 2.0)
45 45
       xpath (~> 0.1.4)
46  
-    childprocess (0.2.1)
  46
+    childprocess (0.2.2)
47 47
       ffi (~> 1.0.6)
48  
-    coffee-rails (3.1.0.rc.5)
49  
-      actionpack (~> 3.1.0.rc1)
  48
+    coffee-rails (3.1.1)
50 49
       coffee-script (>= 2.2.0)
51  
-      railties (~> 3.1.0.rc1)
52  
-      sprockets (>= 2.0.0.beta.9)
  50
+      railties (~> 3.1.0)
53 51
     coffee-script (2.2.0)
54 52
       coffee-script-source
55 53
       execjs
56 54
     coffee-script-source (1.1.2)
57 55
     database_cleaner (0.6.7)
58  
-    devise (1.4.2)
59  
-      bcrypt-ruby (~> 2.1.2)
  56
+    devise (1.4.6)
  57
+      bcrypt-ruby (~> 3.0)
60 58
       orm_adapter (~> 0.0.3)
61 59
       warden (~> 1.0.3)
62 60
     diff-lcs (1.1.2)
@@ -69,13 +67,20 @@ GEM
69 67
       factory_girl (~> 2.0.0)
70 68
       railties (>= 3.0.0)
71 69
     ffi (1.0.9)
  70
+    guard (0.7.0)
  71
+      thor (~> 0.14.6)
  72
+    guard-rspec (0.4.5)
  73
+      guard (>= 0.4.0)
  74
+    guard-spork (0.2.1)
  75
+      guard (>= 0.2.2)
  76
+      spork (>= 0.8.4)
72 77
     haml (3.1.2)
73 78
     haml-rails (0.3.4)
74 79
       actionpack (~> 3.0)
75 80
       activesupport (~> 3.0)
76 81
       haml (~> 3.0)
77 82
       railties (~> 3.0)
78  
-    hike (1.2.0)
  83
+    hike (1.2.1)
79 84
     hpricot (0.8.4)
80 85
     i18n (0.6.0)
81 86
     jasmine (1.1.0.rc3)
@@ -87,7 +92,7 @@ GEM
87 92
     jquery-rails (1.0.13)
88 93
       railties (~> 3.0)
89 94
       thor (~> 0.14)
90  
-    json_pure (1.5.3)
  95
+    json_pure (1.6.1)
91 96
     launchy (2.0.5)
92 97
       addressable (~> 2.2.6)
93 98
     mail (2.3.0)
@@ -95,9 +100,9 @@ GEM
95 100
       mime-types (~> 1.16)
96 101
       treetop (~> 1.4.8)
97 102
     mime-types (1.16)
98  
-    mongo (1.3.1)
99  
-      bson (>= 1.3.1)
100  
-    mongoid (2.1.8)
  103
+    mongo (1.4.0)
  104
+      bson (= 1.4.0)
  105
+    mongoid (2.2.0)
101 106
       activemodel (~> 3.0)
102 107
       mongo (~> 1.3)
103 108
       tzinfo (~> 0.3.22)
@@ -111,36 +116,36 @@ GEM
111 116
     nokogiri (1.5.0)
112 117
     orm_adapter (0.0.5)
113 118
     polyglot (0.3.2)
114  
-    rack (1.3.2)
115  
-    rack-cache (1.0.2)
  119
+    rack (1.3.4)
  120
+    rack-cache (1.0.3)
116 121
       rack (>= 0.4)
117  
-    rack-mount (0.8.2)
  122
+    rack-mount (0.8.3)
118 123
       rack (>= 1.0.0)
119 124
     rack-ssl (1.3.2)
120 125
       rack
121 126
     rack-test (0.6.1)
122 127
       rack (>= 1.0)
123  
-    rails (3.1.0.rc5)
124  
-      actionmailer (= 3.1.0.rc5)
125  
-      actionpack (= 3.1.0.rc5)
126  
-      activerecord (= 3.1.0.rc5)
127  
-      activeresource (= 3.1.0.rc5)
128  
-      activesupport (= 3.1.0.rc5)
  128
+    rails (3.1.0)
  129
+      actionmailer (= 3.1.0)
  130
+      actionpack (= 3.1.0)
  131
+      activerecord (= 3.1.0)
  132
+      activeresource (= 3.1.0)
  133
+      activesupport (= 3.1.0)
129 134
       bundler (~> 1.0)
130  
-      railties (= 3.1.0.rc5)
  135
+      railties (= 3.1.0)
131 136
     rails-backbone (0.5.3)
132 137
       coffee-script (~> 2.2.0)
133 138
       ejs (~> 1.0.0)
134 139
       rails (~> 3.1.0.rc5)
135  
-    railties (3.1.0.rc5)
136  
-      actionpack (= 3.1.0.rc5)
137  
-      activesupport (= 3.1.0.rc5)
  140
+    railties (3.1.0)
  141
+      actionpack (= 3.1.0)
  142
+      activesupport (= 3.1.0)
138 143
       rack-ssl (~> 1.3.2)
139 144
       rake (>= 0.8.7)
140 145
       rdoc (~> 3.4)
141 146
       thor (~> 0.14.6)
142 147
     rake (0.9.2)
143  
-    rdoc (3.9.2)
  148
+    rdoc (3.9.4)
144 149
     rspec (2.6.0)
145 150
       rspec-core (~> 2.6.0)
146 151
       rspec-expectations (~> 2.6.0)
@@ -158,24 +163,25 @@ GEM
158 163
       sexp_processor (~> 3.0)
159 164
     rubyzip (0.9.4)
160 165
     sass (3.1.7)
161  
-    sass-rails (3.1.0.rc.5)
162  
-      actionpack (~> 3.1.0.rc1)
163  
-      railties (~> 3.1.0.rc1)
  166
+    sass-rails (3.1.2)
  167
+      actionpack (~> 3.1.0)
  168
+      railties (~> 3.1.0)
164 169
       sass (>= 3.1.4)
165  
-      sprockets (>= 2.0.0.beta.9)
166  
-    selenium-webdriver (2.4.0)
  170
+      sprockets (~> 2.0.0)
  171
+      tilt (~> 1.3.2)
  172
+    selenium-webdriver (2.8.0)
167 173
       childprocess (>= 0.2.1)
168 174
       ffi (>= 1.0.7)
169 175
       json_pure
170 176
       rubyzip
171 177
     sexp_processor (3.0.6)
172 178
     spork (0.9.0.rc9)
173  
-    sprockets (2.0.0.beta.13)
  179
+    sprockets (2.0.0)
174 180
       hike (~> 1.2)
175 181
       rack (~> 1.0)
176 182
       tilt (!= 1.3.0, ~> 1.1)
177 183
     thor (0.14.6)
178  
-    tilt (1.3.2)
  184
+    tilt (1.3.3)
179 185
     treetop (1.4.10)
180 186
       polyglot
181 187
       polyglot (>= 0.3.1)
@@ -192,25 +198,27 @@ PLATFORMS
192 198
   ruby
193 199
 
194 200
 DEPENDENCIES
195  
-  bson_ext (~> 1.3.1)
196  
-  capybara (~> 1.0.1)
197  
-  coffee-rails (~> 3.1.0.rc)
  201
+  bson_ext (~> 1.4.0)
  202
+  capybara (~> 1.1.1)
  203
+  coffee-rails (~> 3.1.0)
198 204
   database_cleaner (~> 0.6.7)
199  
-  devise (~> 1.4.2)
  205
+  devise (~> 1.4.6)
200 206
   factory_girl_rails (~> 1.1.0)
  207
+  guard-rspec (~> 0.4.5)
  208
+  guard-spork (~> 0.2.1)
201 209
   haml (~> 3.1.2)
202 210
   haml-rails (~> 0.3.4)
203 211
   hpricot (~> 0.8.4)
204 212
   jasmine (~> 1.1.0.rc3)
205 213
   jquery-rails
206 214
   launchy (~> 2.0.5)
207  
-  mongoid (~> 2.1.8)
  215
+  mongoid (~> 2.2.0)
208 216
   mongoid-rspec (~> 1.4.4)
209 217
   mongoid_spacial (~> 0.2.13)
210  
-  rails (= 3.1.0.rc5)
  218
+  rails (= 3.1.0)
211 219
   rails-backbone (~> 0.5.3)
212 220
   rspec-rails (~> 2.6.1)
213 221
   ruby_parser (~> 2.2.0)
214  
-  sass-rails (~> 3.1.0.rc)
215  
-  spork (~> 0.9.0.rc)
  222
+  sass-rails (~> 3.1.0)
  223
+  spork (~> 0.9.0.rc9)
216 224
   uglifier
25  Guardfile
... ...
@@ -0,0 +1,25 @@
  1
+guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
  2
+  watch('config/application.rb')
  3
+  watch('config/environment.rb')
  4
+  watch(%r{^config/environments/.+\.rb$})
  5
+  watch(%r{^config/initializers/.+\.rb$})
  6
+  watch('spec/spec_helper.rb')
  7
+end
  8
+
  9
+guard 'rspec', :version => 2 do
  10
+  watch(%r{^spec/.+_spec\.rb$})
  11
+  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  12
+  watch('spec/spec_helper.rb')  { "spec" }
  13
+
  14
+  # Rails example
  15
+  watch(%r{^spec/.+_spec\.rb$})
  16
+  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  17
+  watch(%r{^lib/(.+)\.rb$})                           { |m| "spec/lib/#{m[1]}_spec.rb" }
  18
+  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  19
+  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  20
+  watch('spec/spec_helper.rb')                        { "spec" }
  21
+  watch('config/routes.rb')                           { "spec/routing" }
  22
+  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
  23
+  # Capybara request specs
  24
+  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
  25
+end
4  app/controllers/events_controller.rb
@@ -4,6 +4,10 @@ class EventsController < ApplicationController
4 4
   def index
5 5
     @events = current_user.events
6 6
   end
  7
+
  8
+  def show
  9
+    @event = current_user.events.find(params[:id])
  10
+  end
7 11
   
8 12
   def create
9 13
     event = current_user.events.build(params[:event])
2  app/views/devise/sessions/new.html.haml
... ...
@@ -1,4 +1,4 @@
1  
-- content_for(:title, 'Sign In')
  1
+- title('Sign In')
2 2
 %h2 Sign in
3 3
 = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
4 4
   %p
2  app/views/events/index.html.haml
@@ -7,6 +7,8 @@
7 7
         =button_to "X", event, :confirm => "Are you sure?", :method => :delete
8 8
       %span.event_name
9 9
         = link_to event.name, edit_event_path(event)
  10
+      %span.event_details
  11
+        = link_to "Show Details", event_path(event)
10 12
       %span.event_description= event.description
11 13
       %div.clear
12 14
 = form_for @event || Event.new do |f|
2  app/views/events/show.html.haml
... ...
@@ -0,0 +1,2 @@
  1
+%h2= @event.name
  2
+.description= @event.description
2  spec/acceptance/add_events_spec.rb
@@ -11,7 +11,7 @@
11 11
     fill_in "Name", :with => "New Event"
12 12
     fill_in "Description", :with => "This is my new event"
13 13
     click_button "Create Event"
14  
-    page.current_path == events_path 
  14
+    page.current_path.should == events_path 
15 15
     page.should have_content("New Event")
16 16
     page.should have_content("This is my new event")
17 17
     page.should have_selector("ul > li")
21  spec/acceptance/show_event_spec.rb
... ...
@@ -0,0 +1,21 @@
  1
+require 'spec_helper'
  2
+
  3
+feature 'Show Event', %q{
  4
+  As a registered user
  5
+  I want to see an Event
  6
+  so I can see my Event Details
  7
+} do
  8
+
  9
+  background do
  10
+    @user = Factory(:user)
  11
+    @event = Factory(:event, :user => @user )
  12
+    login_user @user
  13
+  end
  14
+
  15
+  scenario "Show Event" do
  16
+    click_link "Show Details"
  17
+    page.current_path.should == event_path(@event)
  18
+    page.should have_content(@event.name)
  19
+    page.should have_content(@event.description)
  20
+  end
  21
+end
2  spec/factories.rb
... ...
@@ -1,5 +1,3 @@
1  
-require 'factory_girl'
2  
-
3 1
 FactoryGirl.define do 
4 2
   factory :user do 
5 3
     name 'Testy'

0 notes on commit 515f6aa

Please sign in to comment.
Something went wrong with that request. Please try again.