make sure UsersController#create creates account assocations

refs #5833

Change-Id: I76e2e6879e33cc61752e084ec5d94ca9069fc0f6
Reviewed-on: https://gerrit.instructure.com/6586
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
This commit is contained in:
Cody Cutrer 2011-10-31 10:24:44 -06:00
parent 7be2641834
commit b6fca29032
2 changed files with 3 additions and 0 deletions

View File

@ -499,6 +499,8 @@ class UsersController < ApplicationController
@user.name ||= params[:pseudonym][:unique_id]
@pseudonym ||= @user.pseudonyms.build(:account => @context)
# pre-populate the reverse association
@pseudonym.user = @user
@pseudonym.attributes = params[:pseudonym]
@pseudonym.account = @context
@pseudonym.workflow_state = 'active'

View File

@ -87,6 +87,7 @@ describe UsersController do
p.user.communication_channels.length.should == 1
p.user.communication_channels.first.should be_unconfirmed
p.user.communication_channels.first.path.should == 'jacob@instructure.com'
p.user.associated_accounts.should == [Account.default]
end
it "should complain about conflicting unique_ids" do