-
-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix notifications where resources are missing (#9183)
* fix notifications where resources are missing * Update decidim-core/config/locales/en.yml Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update notification_cell_spec.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
- Loading branch information
1 parent
9fa85fe
commit 4b942aa
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe Decidim::NotificationCell, type: :cell do | ||
subject { my_cell.call } | ||
|
||
controller Decidim::PagesController | ||
let!(:organization) { create :organization } | ||
let(:user) { create :user, :confirmed, organization: organization } | ||
let(:my_cell) { cell("decidim/notification", notification) } | ||
let(:notification) { create :notification, user: user, resource: resource } | ||
let(:component) { create(:component, manifest_name: "dummy", organization: organization) } | ||
let(:resource) { create(:dummy_resource, component: component) } | ||
|
||
context "when resource exists" do | ||
it "Resource title is present" do | ||
expect(my_cell.notification_title).to include("An event occured") | ||
end | ||
end | ||
|
||
context "when resource is missing" do | ||
before do | ||
# rubocop:disable Rails/SkipsModelValidations: | ||
notification.update_attribute(:decidim_resource_type, "Decidim::ParticipatoryProcessStep") | ||
# rubocop:enable Rails/SkipsModelValidations: | ||
end | ||
|
||
it "Resource title is present" do | ||
expect(my_cell.notification_title).to include("this notification belongs to an item that is no longer available") | ||
end | ||
end | ||
end |