Browse files

blah

  • Loading branch information...
1 parent c106d79 commit d4cce92b7f0807a8744c0ecc0eebfd2fd6d1f39f @justinko committed Mar 10, 2010
View
4 app/models/user.rb
@@ -57,7 +57,9 @@ def self.find_by_username_or_email(login)
end
def participate!(quiz)
- participations.create!(:quiz => quiz)
+ participation = participations.build
+ participation.quiz = quiz
+ participation.save!
end
def unparticipate!(quiz)
View
11 spec/controllers/answers_controller_spec.rb
@@ -54,3 +54,14 @@ def answer_params
}
end
end
+
+describe AnswersController, 'User not logged in' do
+ integrate_views
+ fixtures :answers
+
+ it 'should redirect to home' do
+ get :edit, :id => answers(:one).id
+ response.should be_redirect
+ response.should redirect_to(login_url)
+ end
+end
View
26 spec/controllers/dashboards_controller_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe DashboardsController, 'User logged in' do
+ integrate_views
+ fixtures :users
+
+ before do
+ login(users(:justin))
+ end
+
+ it 'should render the show action' do
+ get :show
+ response.should be_success
+ response.should render_template('show')
+ end
+end
+
+describe DashboardsController, 'User not logged in' do
+ integrate_views
+
+ it 'should render the home page' do
+ get :show
+ response.should be_success
+ response.should render_template('pages/home')
+ end
+end

0 comments on commit d4cce92

Please sign in to comment.