Merge pull request #2094 from consul/topic-notifications
Topic notifications
This commit is contained in:
@@ -29,6 +29,8 @@ class NotificationsController < ApplicationController
|
|||||||
case notification.linkable_resource.class.name
|
case notification.linkable_resource.class.name
|
||||||
when "Budget::Investment"
|
when "Budget::Investment"
|
||||||
budget_investment_path @notification.linkable_resource.budget, @notification.linkable_resource
|
budget_investment_path @notification.linkable_resource.budget, @notification.linkable_resource
|
||||||
|
when "Topic"
|
||||||
|
community_topic_path @notification.linkable_resource.community, @notification.linkable_resource
|
||||||
else
|
else
|
||||||
url_for @notification.linkable_resource
|
url_for @notification.linkable_resource
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ feature "Notifications" do
|
|||||||
let(:legislation_question) { create(:legislation_question, process: process, author: administrator) }
|
let(:legislation_question) { create(:legislation_question, process: process, author: administrator) }
|
||||||
let(:legislation_annotation) { create(:legislation_annotation, author: author) }
|
let(:legislation_annotation) { create(:legislation_annotation, author: author) }
|
||||||
|
|
||||||
|
let(:topic) {
|
||||||
|
proposal = create(:proposal)
|
||||||
|
community = proposal.community
|
||||||
|
create(:topic, community: community, author: author)
|
||||||
|
}
|
||||||
|
|
||||||
scenario "User commented on my debate", :js do
|
scenario "User commented on my debate", :js do
|
||||||
create(:notification, notifiable: debate, user: author)
|
create(:notification, notifiable: debate, user: author)
|
||||||
login_as author
|
login_as author
|
||||||
@@ -40,6 +46,19 @@ feature "Notifications" do
|
|||||||
expect(page).to have_xpath "//a[@href='#{notification_path(Notification.last)}']"
|
expect(page).to have_xpath "//a[@href='#{notification_path(Notification.last)}']"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "User commented on my topic", :js do
|
||||||
|
create(:notification, notifiable: topic, user: author)
|
||||||
|
login_as author
|
||||||
|
visit root_path
|
||||||
|
|
||||||
|
find(".icon-notification").click
|
||||||
|
|
||||||
|
expect(page).to have_css ".notification", count: 1
|
||||||
|
|
||||||
|
expect(page).to have_content "Someone commented on"
|
||||||
|
expect(page).to have_xpath "//a[@href='#{notification_path(Notification.last)}']"
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Multiple comments on my proposal", :js do
|
scenario "Multiple comments on my proposal", :js do
|
||||||
login_as user
|
login_as user
|
||||||
visit proposal_path proposal
|
visit proposal_path proposal
|
||||||
|
|||||||
Reference in New Issue
Block a user