mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 14:46:08 +08:00
52 lines
1.1 KiB
Ruby
52 lines
1.1 KiB
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
RSpec.describe "User profile", type: :system do
|
||
|
fab!(:current_user) { Fabricate(:user) }
|
||
|
fab!(:user)
|
||
|
|
||
|
before { chat_system_bootstrap }
|
||
|
|
||
|
shared_examples "not showing chat button" do
|
||
|
it "has no chat button" do
|
||
|
expect(page).to have_no_css(".chat-direct-message-btn")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
shared_examples "showing chat button" do
|
||
|
it "shows the chat button" do
|
||
|
expect(page).to have_css(".chat-direct-message-btn")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def visit_user_profile
|
||
|
visit("/u/" + user.username + "/summary")
|
||
|
end
|
||
|
|
||
|
context "when user" do
|
||
|
context "with chat disabled" do
|
||
|
before do
|
||
|
SiteSetting.chat_enabled = false
|
||
|
sign_in(current_user)
|
||
|
visit_user_profile
|
||
|
end
|
||
|
|
||
|
include_examples "not showing chat button"
|
||
|
end
|
||
|
|
||
|
context "with chat enabled" do
|
||
|
before do
|
||
|
sign_in(current_user)
|
||
|
visit_user_profile
|
||
|
end
|
||
|
|
||
|
include_examples "showing chat button"
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when anonymous" do
|
||
|
before { visit_user_profile }
|
||
|
|
||
|
include_examples "not showing chat button"
|
||
|
end
|
||
|
end
|