Skip to content
This repository

Change sponsorship page to display current year #108

Merged
merged 2 commits into from over 1 year ago

2 participants

Ryan Senior Mario Aquino
Ryan Senior
Owner

The logic was previously to display the max year found in the database. Now this only pulls up the current year of sponsor information. I also needed to upgrade the selenium-webdriver gem to run the cucumber tests (the version we were on didn't work with Firefox 16).

Mario Aquino marioaquino merged commit 6930bdd into from January 14, 2013
Mario Aquino marioaquino closed this January 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
17  Gemfile.lock
@@ -115,8 +115,8 @@ GEM
115 115
       selenium-webdriver (~> 2.0)
116 116
       xpath (~> 0.1.4)
117 117
     carmen (0.2.4)
118  
-    childprocess (0.3.2)
119  
-      ffi (~> 1.0.6)
  118
+    childprocess (0.3.6)
  119
+      ffi (~> 1.0, >= 1.0.6)
120 120
     client_side_validations (3.0.12)
121 121
     columnize (0.3.6)
122 122
     configuration (1.3.1)
@@ -153,7 +153,7 @@ GEM
153 153
     faraday_middleware (0.6.3)
154 154
       faraday (~> 0.6.0)
155 155
     fastercsv (1.5.4)
156  
-    ffi (1.0.11)
  156
+    ffi (1.3.1)
157 157
     formtastic (1.2.4)
158 158
       actionpack (>= 2.3.7)
159 159
       activesupport (>= 2.3.7)
@@ -188,8 +188,9 @@ GEM
188 188
     launchy (0.3.7)
189 189
       configuration (>= 0.0.5)
190 190
       rake (>= 0.8.1)
191  
-    libwebsocket (0.1.3)
  191
+    libwebsocket (0.1.7.1)
192 192
       addressable
  193
+      websocket
193 194
     linecache (0.46)
194 195
       rbx-require-relative (> 0.0.4)
195 196
     mail (2.2.19)
@@ -204,7 +205,7 @@ GEM
204 205
       gem_plugin (~> 0.2.3)
205 206
     moretea-awesome_nested_set (1.4.3.1)
206 207
       activerecord (~> 3.0.0)
207  
-    multi_json (1.3.6)
  208
+    multi_json (1.5.0)
208 209
     multipart-post (1.1.5)
209 210
     mysql2 (0.2.7)
210 211
     nokogiri (1.5.0)
@@ -266,15 +267,14 @@ GEM
266 267
     ruby-debug-base (0.10.4)
267 268
       linecache (>= 0.3)
268 269
     ruby-prof (0.11.2)
269  
-    rubyzip (0.9.8)
  270
+    rubyzip (0.9.9)
270 271
     savon (0.9.1)
271 272
       builder (>= 2.1.2)
272 273
       crack (~> 0.1.8)
273 274
       gyoku (>= 0.4.0)
274 275
       httpi (>= 0.7.8)
275  
-    selenium-webdriver (2.22.2)
  276
+    selenium-webdriver (2.27.2)
276 277
       childprocess (>= 0.2.5)
277  
-      ffi (~> 1.0)
278 278
       libwebsocket (~> 0.1.3)
279 279
       multi_json (~> 1.0)
280 280
       rubyzip
@@ -298,6 +298,7 @@ GEM
298 298
     uuidtools (2.1.2)
299 299
     warden (1.0.6)
300 300
       rack (>= 1.0)
  301
+    websocket (1.0.6)
301 302
     will_paginate (3.0.3)
302 303
     xpath (0.1.4)
303 304
       nokogiri (~> 1.3)
9  spec/factories.rb
@@ -169,6 +169,10 @@
169 169
   sl.year Time.now.year - 1
170 170
 end
171 171
 
  172
+Factory.define :platinum_next_year, :parent => :sponsorship_level do |sl|
  173
+  sl.year Time.now.year + 1
  174
+end
  175
+
172 176
 Factory.define :silver, :parent => :sponsorship_level do |sl|
173 177
   sl.name 'Silver'
174 178
   sl.position 2
@@ -208,6 +212,11 @@
208 212
   ps.sponsorship_level { Factory(:platinum_last_year) }
209 213
 end
210 214
 
  215
+Factory.define :platinum_sponsorship_next_year, :parent => :sponsorship do |ps|
  216
+  ps.year Time.now.year + 1
  217
+  ps.sponsorship_level { Factory(:platinum_next_year) }
  218
+end
  219
+
211 220
 Factory.define :silver_sponsorship, :parent => :sponsorship do |ss|
212 221
   ss.sponsorship_level { Factory(:silver) }
213 222
 end
2  vendor/engines/sponsorships/app/models/sponsorship.rb
@@ -27,7 +27,7 @@ class Sponsorship < ActiveRecord::Base
27 27
   end
28 28
 
29 29
   #For specific or latest year
30  
-  scope :for_year, lambda {|year| where(:year => year || maximum('year')) }
  30
+  scope :for_year, lambda {|year| where(:year => year || Time.now.year ) }
31 31
   scope :visible, where(:visible => true)
32 32
 
33 33
   def title
6  vendor/engines/sponsorships/spec/models/sponsorship_spec.rb
@@ -32,6 +32,7 @@
32 32
   context "#current_sponsorships" do
33 33
     let(:platinum_sponsorship) { Factory(:platinum_sponsorship) }
34 34
     let(:platinum_sponsorship_last_year) { Factory(:platinum_sponsorship_last_year) }
  35
+    let!(:platinum_sponsorship_next_year) { Factory(:platinum_sponsorship_next_year) }
35 36
     let(:silver_sponsorship) { Factory(:silver_sponsorship) }
36 37
     let(:bronze_sponsorship) { Factory(:bronze_sponsorship) }
37 38
 
@@ -49,6 +50,11 @@
49 50
           bronze_sponsorship.sponsorship_level.name => [bronze_sponsorship]}
50 51
     end
51 52
 
  53
+    it "should allow specifying year" do
  54
+      Sponsorship.visible_sponsorships_by_level_name(Time.now.year + 1).should ==
  55
+        {platinum_sponsorship_next_year.sponsorship_level.name => [platinum_sponsorship_next_year]}
  56
+    end
  57
+
52 58
     it "hides non-visible sponsorships" do
53 59
       silver_sponsorship.visible = false
54 60
       silver_sponsorship.save
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.