diff options
Diffstat (limited to 'spec/features/broadcast_messages_spec.rb')
-rw-r--r-- | spec/features/broadcast_messages_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/features/broadcast_messages_spec.rb b/spec/features/broadcast_messages_spec.rb index 3e4289347e3..2fad15c8a1f 100644 --- a/spec/features/broadcast_messages_spec.rb +++ b/spec/features/broadcast_messages_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Broadcast Messages', feature_category: :onboarding do shared_examples 'a Broadcast Messages' do |type| it 'shows broadcast message' do - visit root_path + visit explore_projects_path expect(page).to have_content 'SampleMessage' end @@ -15,17 +15,17 @@ RSpec.describe 'Broadcast Messages', feature_category: :onboarding do it 'renders styled links' do create(:broadcast_message, type, message: "<a href='gitlab.com' style='color: purple'>click me</a>") - visit root_path + visit explore_projects_path expected_html = "<p><a href=\"gitlab.com\" style=\"color: purple\">click me</a></p>" expect(page.body).to include(expected_html) end end - shared_examples 'a dismissable Broadcast Messages' do + shared_examples 'a dismissible Broadcast Messages' do it 'hides broadcast message after dismiss', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/390900' do - visit root_path + visit explore_projects_path find('.js-dismiss-current-broadcast-notification').click @@ -34,25 +34,25 @@ RSpec.describe 'Broadcast Messages', feature_category: :onboarding do it 'broadcast message is still hidden after refresh', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/391406' do - visit root_path + visit explore_projects_path find('.js-dismiss-current-broadcast-notification').click wait_for_cookie_set("hide_broadcast_message_#{broadcast_message.id}") - visit root_path + visit explore_projects_path expect(page).not_to have_content 'SampleMessage' end end describe 'banner type' do - let!(:broadcast_message) { create(:broadcast_message, message: 'SampleMessage') } + let_it_be(:broadcast_message) { create(:broadcast_message, message: 'SampleMessage') } it_behaves_like 'a Broadcast Messages' - it 'is not dismissable' do - visit root_path + it 'is not dismissible' do + visit explore_projects_path expect(page).not_to have_selector('.js-dismiss-current-broadcast-notification') end @@ -62,33 +62,33 @@ RSpec.describe 'Broadcast Messages', feature_category: :onboarding do sign_in(user) - visit root_path + visit explore_projects_path expect(page).to have_content 'Hi {{name}}' end end - describe 'dismissable banner type' do - let!(:broadcast_message) { create(:broadcast_message, dismissable: true, message: 'SampleMessage') } + describe 'dismissible banner type' do + let_it_be(:broadcast_message) { create(:broadcast_message, dismissable: true, message: 'SampleMessage') } it_behaves_like 'a Broadcast Messages' - it_behaves_like 'a dismissable Broadcast Messages' + it_behaves_like 'a dismissible Broadcast Messages' end describe 'notification type' do - let!(:broadcast_message) { create(:broadcast_message, :notification, message: 'SampleMessage') } + let_it_be(:broadcast_message) { create(:broadcast_message, :notification, message: 'SampleMessage') } it_behaves_like 'a Broadcast Messages', :notification - it_behaves_like 'a dismissable Broadcast Messages' + it_behaves_like 'a dismissible Broadcast Messages' it 'replaces placeholders' do create(:broadcast_message, :notification, message: 'Hi {{name}}') sign_in(user) - visit root_path + visit explore_projects_path expect(page).to have_content "Hi #{user.name}" end |