Merge pull request #2094 from consul/topic-notifications

Topic notifications
This commit is contained in:
Alberto García
2017-10-25 11:08:00 +02:00
committed by GitHub
2 changed files with 21 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ class NotificationsController < ApplicationController
case notification.linkable_resource.class.name
when "Budget::Investment"
budget_investment_path @notification.linkable_resource.budget, @notification.linkable_resource
when "Topic"
community_topic_path @notification.linkable_resource.community, @notification.linkable_resource
else
url_for @notification.linkable_resource
end

View File

@@ -14,6 +14,12 @@ feature "Notifications" do
let(:legislation_question) { create(:legislation_question, process: process, author: administrator) }
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
create(:notification, notifiable: debate, user: author)
login_as author
@@ -40,6 +46,19 @@ feature "Notifications" do
expect(page).to have_xpath "//a[@href='#{notification_path(Notification.last)}']"
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
login_as user
visit proposal_path proposal