Class: Decidim::DummyResources::DummyResource

Inherits:
ApplicationRecord show all
Includes:
Amendable, Authorable, Comments::Commentable, Decidim::DataPortability, Endorsable, HasAttachments, NewsletterParticipant, ShareableWithToken, TranslatableResource, Followable, HasCategory, HasComponent, HasReference, Paddable, Publicable, Reportable, Resourceable, ScopableResource, Searchable, Traceable
Defined in:
lib/decidim/dev/test/rspec_support/component.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.export_serializerObject



104
105
106
# File 'lib/decidim/dev/test/rspec_support/component.rb', line 104

def self.export_serializer
  DummySerializer
end

.newsletter_participant_ids(component) ⇒ Object



108
109
110
111
112
113
# File 'lib/decidim/dev/test/rspec_support/component.rb', line 108

def self.newsletter_participant_ids(component)
  Decidim::DummyResources::DummyResource.where(component: component).joins(:component)
                                        .where(decidim_author_type: Decidim::UserBaseEntity.name)
                                        .where.not(author: nil)
                                        .pluck(:decidim_author_id).flatten.compact.uniq
end

.user_collection(user) ⇒ Object



100
101
102
# File 'lib/decidim/dev/test/rspec_support/component.rb', line 100

def self.user_collection(user)
  where(decidim_author_id: user.id, decidim_author_type: "Decidim::User")
end

Instance Method Details

#allow_resource_permissions?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/decidim/dev/test/rspec_support/component.rb', line 96

def allow_resource_permissions?
  component.settings.resources_permissions_enabled
end

#reported_content_urlObject



92
93
94
# File 'lib/decidim/dev/test/rspec_support/component.rb', line 92

def reported_content_url
  ResourceLocatorPresenter.new(self).url
end