Skip to content
Browse files

Merge branch 'release/0.1.7'

  • Loading branch information...
2 parents 62da7d0 + 9f0194e commit 46520fa6168125c16122928fcad0dbf2397c573f @jeffkreeftmeijer jeffkreeftmeijer committed Jun 25, 2011
View
4 app/assets/stylesheets/sass/application.sass.erb
@@ -244,5 +244,9 @@ strong
width: 73px
display: block
+span#submitter
+ font-size: 12px
+ color: #666
+
em
font-style: italic
View
3 app/models/contest.rb
@@ -12,11 +12,12 @@ class Contest
slug :name
- validates :name, :description, :starting_on, :presence => true
+ validates :user, :name, :description, :starting_on, :presence => true
before_create :set_voting_and_closing_dates
embeds_many :entries
+ belongs_to :user
def set_voting_and_closing_dates
self.voting_on = starting_on + 1.week if self.voting_on.blank?
View
3 app/views/contests/show.haml
@@ -2,6 +2,9 @@
- content_for(:description){ @contest.tagline }
%h2= @contest.name
+%span#submitter
+ Submitted by
+ =link_to @contest.user.login, @contest.user
= raw Kramdown::Document.new(@contest.description).to_html
View
11 spec/acceptance/contests_spec.rb
@@ -48,7 +48,8 @@
:name => 'RSpec extensions',
:description => 'Write an [RSpec](http://relishapp.com/rspec) extension that solves a problem you are having.',
:starting_on => Date.yesterday.to_time,
- :entries => [ Fabricate(:entry_with_files), @entry ]
+ :entries => [ Fabricate(:entry_with_files), @entry ],
+ :user => Fabricate(:user, :login => 'bob')
)
end
end
@@ -57,7 +58,13 @@
visit "/contests/#{@contest.slug}"
login_via_github
end
-
+
+ scenario 'see the contest submitter' do
+ page.should have_content 'Submitted by bob'
+ page.should have_link 'bob'
+ body.should include 'href="/users/bob"'
+ end
+
scenario 'read the markdown contest description' do
body.should include 'Write an <a href="http://relishapp.com/rspec">RSpec</a> extension that solves a problem you are having.'
end
View
1 spec/fabricators/contest_fabricator.rb
@@ -3,4 +3,5 @@
tagline { Faker::Lorem.sentence(7) }
description { Faker::Lorem.sentence(25) }
starting_on { Date.parse('May 23 2011') }
+ user
end
View
2 spec/fabricators/user_fabricator.rb
@@ -1,6 +1,6 @@
Fabricator(:user) do
login { 'charlie' }
- name { 'Charlie' }
+ name { 'Charlie Chaplin' }
github_id { '1763' }
email { 'charlie@email.com' }
end
View
11 spec/models/contest_spec.rb
@@ -17,6 +17,8 @@
it { should have(1).error_on(:description) }
it { should have(1).error_on(:starting_on) }
+
+ it { should have(1).error_on(:user) }
end
@@ -84,6 +86,15 @@
end
end
+
+ context '#user' do
+
+ it 'should have a user' do
+ user = Fabricate.build(:user)
+ Fabricate.build(:contest, :user => user).user.should == user
+ end
+
+ end
context '#pending?' do

0 comments on commit 46520fa

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