Merge branch 'master' of bitbucket.org:jamkazam/jam-web

This commit is contained in:
Brian Smith 2012-11-21 14:50:41 -05:00
commit c849ae0536
4 changed files with 46 additions and 2 deletions

View File

@ -49,10 +49,13 @@ class SessionsController < ApplicationController
nil, # @country
nil,
nil)
# Users who sign up using oauth are presumed to have valid email adddresses.
user.confirm_email!
auth = user.user_authorizations.build :provider => auth_hash[:provider], :uid => auth_hash[:uid],
:token => auth_hash[:credentials][:token], :token_expiration => Time.at(auth_hash[:credentials][:expires_at])
user.save
auth.save
complete_sign_in user
end
end

View File

@ -9,7 +9,7 @@ class UserManager < BaseManager
end
def signup(first_name, last_name, email, password, password_confirmation,
city, state, country, instruments, signup_confirm_url)
city, state, country, instruments, signup_confirm_url)
@user = User.new

View File

@ -0,0 +1,41 @@
require 'spec_helper'
describe SessionsController do
render_views
describe "GET 'new'" do
it "should work" do
get :new
response.should be_success
end
it "should have the right title" do
get :new
response.body.should have_selector('title', :content => "Jamkazam | Sign in")
end
end
describe "POST 'create'" do
before(:each) do
@user = Factory(:user)
@attr = { :email => @user.email, :password => @user.password }
end
it "should sign the user in" do
post :create, :session => @attr
controller.current_user.should == @user
controller.signed_in?.should == true
end
it "should redirect the user to the proper page" do
post :create, :session => @attr
response.should redirect_to(client_url)
end
end
end