DEV: Fix a constant redefinition warning (#20842)

This commit is contained in:
Jarek Radosz 2023-03-27 13:34:25 +02:00 committed by GitHub
parent 142ef6088c
commit 65b1381575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View File

@ -5,6 +5,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
let(:chat_page) { PageObjects::Pages::Chat.new }
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
let(:key_modifier) { RUBY_PLATFORM =~ /darwin/i ? :meta : :control }
before do
chat_system_bootstrap
@ -12,13 +13,11 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
visit("/")
end
KEY_MODIFIER = RUBY_PLATFORM =~ /darwin/i ? :meta : :control
context "when used with public channel" do
fab!(:channel_1) { Fabricate(:category_channel) }
it "works" do
find("body").send_keys([KEY_MODIFIER, "k"])
find("body").send_keys([key_modifier, "k"])
find("#chat-channel-selector-input").fill_in(with: channel_1.title)
find(".chat-channel-selection-row[data-id='#{channel_1.id}']").click
channel_page.send_message("Hello world")
@ -31,7 +30,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
fab!(:user_1) { Fabricate(:user) }
it "works" do
find("body").send_keys([KEY_MODIFIER, "k"])
find("body").send_keys([key_modifier, "k"])
find("#chat-channel-selector-input").fill_in(with: user_1.username)
find(".chat-channel-selection-row[data-id='#{user_1.id}']").click
channel_page.send_message("Hello world")
@ -44,7 +43,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user]) }
it "works" do
find("body").send_keys([KEY_MODIFIER, "k"])
find("body").send_keys([key_modifier, "k"])
find("#chat-channel-selector-input").fill_in(with: current_user.username)
find(".chat-channel-selection-row[data-id='#{dm_channel_1.id}']").click
channel_page.send_message("Hello world")
@ -58,7 +57,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
it "it doesnt include current channel" do
chat_page.visit_channel(channel_1)
find("body").send_keys([KEY_MODIFIER, "k"])
find("body").send_keys([key_modifier, "k"])
find("#chat-channel-selector-input").click
expect(page).to have_no_css(".chat-channel-selection-row[data-id='#{channel_1.id}']")
@ -71,7 +70,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
it "it doesnt include limited access channel" do
chat_page.visit_channel(channel_1)
find("body").send_keys([KEY_MODIFIER, "k"])
find("body").send_keys([key_modifier, "k"])
find("#chat-channel-selector-input").fill_in(with: channel_1.title)
expect(page).to have_no_css(".chat-channel-selection-row[data-id='#{channel_1.id}']")

View File

@ -6,8 +6,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
let(:chat) { PageObjects::Pages::Chat.new }
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
KEY_MODIFIER = RUBY_PLATFORM =~ /darwin/i ? :meta : :control
let(:key_modifier) { RUBY_PLATFORM =~ /darwin/i ? :meta : :control }
before do
chat_system_bootstrap
@ -25,7 +24,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
chat.visit_channel(channel_1)
within(".chat-composer-input") do |composer|
composer.send_keys([KEY_MODIFIER, "b"])
composer.send_keys([key_modifier, "b"])
expect(composer.value).to eq("**strong text**")
end
@ -37,7 +36,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
chat.visit_channel(channel_1)
within(".chat-composer-input") do |composer|
composer.send_keys([KEY_MODIFIER, "i"])
composer.send_keys([key_modifier, "i"])
expect(composer.value).to eq("_emphasized text_")
end
@ -49,7 +48,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
chat.visit_channel(channel_1)
within(".chat-composer-input") do |composer|
composer.send_keys([KEY_MODIFIER, "e"])
composer.send_keys([key_modifier, "e"])
expect(composer.value).to eq("`indent preformatted text by 4 spaces`")
end