Skip to content

Lookup user by id, not username - fixes AR::RecordNotFound [WIP-334] #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/workers/user_activate_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def perform(user_id)
user = User.find(user_id)
return if user.active?

RefreshUserJob.new.perform(user.username)
RefreshUserJob.new.perform(user.id)
NotifierMailer.welcome_email(user.username).deliver

user.activate!
Expand Down
13 changes: 13 additions & 0 deletions spec/workers/user_activate_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
expect(user.active?).to eq(true)
expect(user.activated_on).not_to eq(nil)
end

it "should send welcome mail" do
mail = double("mail")
expect(NotifierMailer).to receive(:welcome_email).with(user.username).and_return(mail)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [94/80]

expect(mail).to receive(:deliver)
worker.perform(user.id)
end

it "should create refresh job" do
expect_any_instance_of(RefreshUserJob).to receive(:perform).with(user.id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [81/80]

worker.perform(user.id)
end

end

context 'when activate user' do
Expand Down