discourse/plugins/chat/spec/requests/users_controller_spec.rb
Roman Rizzi 0a5f548635
DEV: Move discourse-chat to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00

26 lines
823 B
Ruby

# frozen_string_literal: true
describe UsersController do
describe "#perform_account_activation" do
let!(:channel) { Fabricate(:category_channel, auto_join_users: true) }
before do
Jobs.run_immediately!
UsersController.any_instance.stubs(:honeypot_or_challenge_fails?).returns(false)
SiteSetting.send_welcome_message = false
SiteSetting.chat_enabled = true
end
it "triggers the auto-join process" do
user = Fabricate(:user, last_seen_at: 1.minute.ago, active: false)
email_token = Fabricate(:email_token, user: user)
put "/u/activate-account/#{email_token.token}"
expect(response.status).to eq(200)
membership = UserChatChannelMembership.find_by(user: user, chat_channel: channel)
expect(membership.following).to eq(true)
end
end
end