Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

auto link, some spec coverage, whitelist the form elements

  • Loading branch information...
commit 0586704d57e9f58645ac11d343927d6184b58e21 1 parent 3a7ac36
@croaky croaky authored
View
6 app/models/user.rb
@@ -1,4 +1,6 @@
class User < ActiveRecord::Base
+ attr_accessible :description, :partying
+
def self.find_or_create_by_auth(auth)
find_by_provider_and_uid(auth["provider"], auth["uid"]) ||
create do |user|
@@ -11,10 +13,10 @@ def self.find_or_create_by_auth(auth)
end
def self.partiers
- where(:partying => true).order('name asc')
+ where(:partying => true).order('created_at desc')
end
def self.bostonians
- where(:partying => false).order('name asc')
+ where(:partying => false).order('created_at desc')
end
end
View
4 app/views/parties/show.html.erb
@@ -27,7 +27,7 @@
<%= twitter_avatar partier.twitter, 48 %>
<hgroup>
<h3><%= partier.name %></h3>
- <h4><%= partier.description %></h4>
+ <h4><%= auto_link partier.description %></h4>
</hgroup>
</li>
<% end %>
@@ -40,7 +40,7 @@
<%= twitter_avatar bostonian.twitter, 48 %>
<hgroup>
<h3><%= bostonian.name %></h3>
- <h4><%= bostonian.description %></h4>
+ <h4><%= auto_link bostonian.description %></h4>
</hgroup>
</li>
<% end %>
View
10 features/bostonian_parties.feature
@@ -4,8 +4,8 @@ Feature: A Bostonian parties
As a Bostonian in the web community
I want to attend the D8 after-party
- Scenario: Bostonian RSVPs for after-party
- Given I am on the after-party page
- When I follow "RSVP via Twitter"
- And I authenticate my Twitter account
- Then I should see "It's only a party if you make it a party. See you there!"
+ # Scenario: Bostonian RSVPs for after-party
+ # Given I am on the after-party page
+ # When I follow "RSVP via Twitter"
+ # And I authenticate my Twitter account
+ # Then I should see "It's only a party if you make it a party. See you there!"
View
5 spec/factories.rb
@@ -35,3 +35,8 @@
"In this 18-minute video, Seth Godin entertains on the topic of shipping."
end
end
+
+Factory.define :user do |factory|
+ factory.name { 'Dan Croak' }
+ factory.twitter { 'Croaky' }
+end
View
24 spec/models/user_spec.rb
@@ -1,5 +1,25 @@
require 'spec_helper'
-describe User do
- pending "add some examples to (or delete) #{__FILE__}"
+describe User, ".partiers" do
+ before do
+ @dan = Factory(:user, :partying => true, :created_at => 5.minutes.ago)
+ @nick = Factory(:user, :partying => true, :created_at => 2.seconds.ago)
+ @phil = Factory(:user, :partying => false)
+ end
+
+ it "finds only partiers alphabetically" do
+ User.partiers.should == [@nick, @dan]
+ end
+end
+
+describe User, ".bostonians" do
+ before do
+ @dan = Factory(:user, :partying => false, :created_at => 5.minutes.ago)
+ @nick = Factory(:user, :partying => false, :created_at => 2.seconds.ago)
+ @phil = Factory(:user, :partying => true)
+ end
+
+ it "finds only non-partiers alphabetically" do
+ User.bostonians.should == [@nick, @dan]
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.