mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:41:07 +08:00
FEATURE: user status emoji (#17025)
This commit is contained in:

committed by
GitHub

parent
0b8e6adabe
commit
033f72c65f
@ -25,32 +25,46 @@ describe UserStatusController do
|
||||
SiteSetting.enable_user_status = true
|
||||
end
|
||||
|
||||
it "sets user status" do
|
||||
status = "off to dentist"
|
||||
put "/user-status.json", params: { description: status }
|
||||
expect(user.user_status.description).to eq(status)
|
||||
it 'the description parameter is mandatory' do
|
||||
put "/user-status.json", params: { emoji: "tooth" }
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
it 'the description parameter is mandatory' do
|
||||
put "/user-status.json", params: {}
|
||||
it 'the emoji parameter is mandatory' do
|
||||
put "/user-status.json", params: { description: "off to dentist" }
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
it "sets user status" do
|
||||
status = "off to dentist"
|
||||
status_emoji = "tooth"
|
||||
put "/user-status.json", params: { description: status, emoji: status_emoji }
|
||||
expect(user.user_status.description).to eq(status)
|
||||
expect(user.user_status.emoji).to eq(status_emoji)
|
||||
end
|
||||
|
||||
it "following calls update status" do
|
||||
status = "off to dentist"
|
||||
put "/user-status.json", params: { description: status }
|
||||
status_emoji = "tooth"
|
||||
put "/user-status.json", params: { description: status, emoji: status_emoji }
|
||||
user.reload
|
||||
expect(user.user_status.description).to eq(status)
|
||||
expect(user.user_status.emoji).to eq(status_emoji)
|
||||
|
||||
new_status = "working"
|
||||
put "/user-status.json", params: { description: new_status }
|
||||
new_status = "surfing"
|
||||
new_status_emoji = "surfing_man"
|
||||
put "/user-status.json", params: { description: new_status, emoji: new_status_emoji }
|
||||
user.reload
|
||||
expect(user.user_status.description).to eq(new_status)
|
||||
expect(user.user_status.emoji).to eq(new_status_emoji)
|
||||
end
|
||||
|
||||
it "publishes to message bus" do
|
||||
status = "off to dentist"
|
||||
messages = MessageBus.track_publish { put "/user-status.json", params: { description: status } }
|
||||
emoji = "tooth"
|
||||
messages = MessageBus.track_publish do
|
||||
put "/user-status.json", params: { description: status, emoji: emoji }
|
||||
end
|
||||
|
||||
expect(messages.size).to eq(1)
|
||||
expect(messages[0].channel).to eq("/user-status/#{user.id}")
|
||||
|
Reference in New Issue
Block a user