From 271c1595baed18467ca6bdb74b1f3fd393c72bda Mon Sep 17 00:00:00 2001 From: iagirre Date: Thu, 22 Feb 2018 13:36:41 +0100 Subject: [PATCH] Changed the way the notifications page is accessed. Instead of doing it through UI, after the notifications are created the test goes directly to the notifications page (after login in the user). To check if the notification icon is correctly shown, a new test has been created that only does that. --- spec/shared/features/notifiable_in_app.rb | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/spec/shared/features/notifiable_in_app.rb b/spec/shared/features/notifiable_in_app.rb index 64e1e9691..4010fa2ca 100644 --- a/spec/shared/features/notifiable_in_app.rb +++ b/spec/shared/features/notifiable_in_app.rb @@ -3,6 +3,15 @@ shared_examples "notifiable in-app" do |described_class| let(:author) { create(:user, :verified) } let!(:notifiable) { create(model_name(described_class), author: author) } + scenario "Notification icon is shown" do + notification = create(:notification, notifiable: notifiable, user: author) + + login_as author + visit root_path + + expect(page).to have_css ".icon-notification" + end + scenario "A user commented on my notifiable", :js do notification = create(:notification, notifiable: notifiable, user: author) @@ -26,13 +35,11 @@ shared_examples "notifiable in-app" do |described_class| within "#comments" do expect(page).to have_content "I agree" end + logout end - logout login_as author - visit root_path - visit root_path - find(".icon-notification").click + visit notifications_path expect(page).to have_css ".notification", count: 1 expect(page).to have_content "There are 3 new comments on" @@ -57,9 +64,7 @@ shared_examples "notifiable in-app" do |described_class| logout login_as author - visit root_path - visit root_path - find(".icon-notification").click + visit notifications_path expect(page).to have_css ".notification", count: 1 expect(page).to have_content "Someone replied to your comment on" @@ -86,9 +91,7 @@ shared_examples "notifiable in-app" do |described_class| end login_as author - visit root_path - visit root_path - find(".icon-notification").click + visit notifications_path expect(page).to have_css ".notification", count: 1 expect(page).to have_content "There are 3 new replies to your comment on" @@ -134,4 +137,4 @@ shared_examples "notifiable in-app" do |described_class| end -end \ No newline at end of file +end