Skip to content

Commit

Permalink
Fixing failing tests in decidim modules
Browse files Browse the repository at this point in the history
* Fixing Validation syntax
* Use local version of system_test_html_screenshots
* Fixing: "unknown attribute 'service_name' for ActiveStorage::Blob"
* Fix Main spec- Gemfile integrity
* Lint active_storage migrations
* Fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: decidim/application/_documents.html
* Fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: decidim/shared/_follow_button.html
* Fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: decidim/application/_photos.html
* Fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: decidim/shared/_extended_navigation_bar.html
* Fix: DEPRECATION WARNING: Calling  to an ActiveModel::Errors message array in order to add an error is deprecated
* Fix: menu_item_presenter Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
* Fix: permissions_spec.rb:16: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
* Fix: DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is deprecated without replacement. If the `throw` came from
* Fix: undefined method `add_template_helper' for ...
* Fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: decidim/application/_attachments.html (called from attachments_for
* Ignore controller specs for now
* Fix: undefined method 'file_fixture_path'
* fix: ArgumentError: wrong number of arguments (given 1, expected 3)
* Fix: Template missing: view:  prefixes
* Fix: ActionMailer queue name
* Running linters
* Fix: wrong number of arguments (given 1, expected 3)
* Fix: DEPRECATION WARNING: create_after_upload! is deprecated and will be removed from Rails 6.2 (use create_and_upload! instead)
* Fix: wrong number of arguments (given 1, expected 3)
* Fix: ERROR:  missing FROM-clause entry for table "component"
* Fix: Cell cache key test
* Fix: undefined method `size' for Rectify::Query
* Fix: DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: decidim/application/_document.html
* Fix: undefined method 'title' for nil:NilClass
* Fix: Template missing: view:  prefixes
* Linters
* Fix: Proposal image test
* Fixing Consultation tests
* Fix Ballout error on elections
* Fix Polling Officer related tests
* Attempt to fix initiative test suite
  • Loading branch information
alecslupu committed Oct 19, 2021
1 parent 81038ab commit d631326
Show file tree
Hide file tree
Showing 61 changed files with 398 additions and 259 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Decidim::Admin
}
end
let(:uploaded_image) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg"
Expand Down Expand Up @@ -71,7 +71,7 @@ module Decidim::Admin

context "when the image exists" do
let(:original_image) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg"
Expand Down
2 changes: 1 addition & 1 deletion decidim-admin/spec/lib/admin/form_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Decidim
describe Admin::FormBuilder do
let(:subject) { Nokogiri::HTML(output) }

let(:helper) { Class.new(ActionView::Base).new(ActionView::LookupContext.new(nil)) }
let(:helper) { Class.new(ActionView::Base).new(ActionView::LookupContext.new(ActionController::Base.view_paths), {}, []) }
let(:available_locales) { %w(ca en de-CH) }

let(:resource) do
Expand Down
14 changes: 7 additions & 7 deletions decidim-assemblies/lib/decidim/assemblies/participatory_space.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
organization: organization,
hero_image: ActiveStorage::Blob.create_after_upload!(
hero_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "hero_image.jpeg",
content_type: "image/jpeg",
metadata: nil
), # Keep after organization
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -159,13 +159,13 @@
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
organization: organization,
hero_image: ActiveStorage::Blob.create_after_upload!(
hero_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "hero_image.jpeg",
content_type: "image/jpeg",
metadata: nil
), # Keep after organization
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -197,7 +197,7 @@
attachment_collection: attachment_collection,
attached_to: current_assembly,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand All @@ -210,7 +210,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: current_assembly,
content_type: "image/jpeg",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg",
Expand All @@ -223,7 +223,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: current_assembly,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand Down
2 changes: 1 addition & 1 deletion decidim-assemblies/spec/commands/create_assembly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module Decidim::Assemblies

context "when the uploaded hero image has too large dimensions" do
let(:hero_image) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("5000x5000.png")),
filename: "5000x5000.png",
content_type: "image/png"
Expand Down
2 changes: 1 addition & 1 deletion decidim-assemblies/spec/commands/update_assembly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module Decidim::Assemblies
let(:attachment_params) do
{
banner_image: banner_image.blob,
hero_image: ActiveStorage::Blob.create_after_upload!(
hero_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("5000x5000.png")),
filename: "5000x5000.png",
content_type: "image/png"
Expand Down
8 changes: 4 additions & 4 deletions decidim-budgets/lib/decidim/budgets/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

component.register_stat :orders_count do |components, start_at, end_at|
budgets = Decidim::Budgets::Budget.where(component: components)
orders = Decidim::Budgets::Order.where(component: budgets)
orders = Decidim::Budgets::Order.where(budget: budgets)
orders = orders.where("created_at >= ?", start_at) if start_at.present?
orders = orders.where("created_at <= ?", end_at) if end_at.present?
orders.count
Expand Down Expand Up @@ -163,7 +163,7 @@
attachment_collection: attachment_collection,
attached_to: project,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(__dir__, "seeds", "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand All @@ -175,7 +175,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: project,
content_type: "image/jpeg",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(__dir__, "seeds", "city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg",
Expand All @@ -187,7 +187,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: project,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(__dir__, "seeds", "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
organization: organization,
hero_image: ActiveStorage::Blob.create_after_upload!(
hero_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "hero_image.jpeg",
content_type: "image/jpeg",
metadata: nil
), # Keep after organization
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -126,7 +126,7 @@
attachment_collection: attachment_collection,
attached_to: conference,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand All @@ -139,7 +139,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: conference,
content_type: "image/jpeg",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg",
Expand All @@ -152,7 +152,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: conference,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand Down Expand Up @@ -193,7 +193,7 @@
link: Faker::Internet.url,
partner_type: type,
conference: conference,
logo: ActiveStorage::Blob.create_after_upload!(
logo: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "logo.png")),
filename: "logo.png",
content_type: "image/png",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Decidim::Conferences
end
let(:meeting_ids) { meetings.map(&:id) }
let(:avatar) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("avatar.jpg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down Expand Up @@ -73,7 +73,7 @@ module Decidim::Conferences

context "when image is invalid" do
let(:avatar) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("invalid.jpeg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down
4 changes: 2 additions & 2 deletions decidim-conferences/spec/commands/create_partner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Decidim::Conferences
let(:user) { nil }
let!(:current_user) { create :user, :confirmed, organization: conference.organization }
let(:logo) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("avatar.jpg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down Expand Up @@ -50,7 +50,7 @@ module Decidim::Conferences

context "when image is invalid" do
let(:logo) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("invalid.jpeg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Decidim::Conferences
end
let(:meeting_ids) { meetings.map(&:id) }
let(:avatar) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("avatar.jpg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down Expand Up @@ -73,7 +73,7 @@ module Decidim::Conferences

context "when image is invalid" do
let(:avatar) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("invalid.jpeg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down
4 changes: 2 additions & 2 deletions decidim-conferences/spec/commands/update_partner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Decidim::Conferences
let(:partner) { create :partner, :main_promotor, conference: conference }
let!(:current_user) { create :user, :confirmed, organization: conference.organization }
let(:logo) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("avatar.jpg")),
filename: "avatar.jpeg",
content_type: "image/jpeg"
Expand Down Expand Up @@ -49,7 +49,7 @@ module Decidim::Conferences

context "when image is invalid" do
let(:logo) do
ActiveStorage::Blob.create_after_upload!(
ActiveStorage::Blob.create_and_upload!(
io: File.open(Decidim::Dev.asset("invalid.jpeg")),
filename: "invalid.jpeg",
content_type: "image/jpeg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<div class="row">
<div class="columns medium-8 medium-offset-2">
<%= form_with url: decidim_consultations.question_question_votes_path(question),
local: false,
id: "confirm-vote-form" do |form| %>
<%= form.hidden_field :decidim_consultations_response_id, id: "decidim_consultations_response_id" %>
<%= form.submit t("questions.vote_modal_confirm.confirm", scope: "decidim"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
start_voting_date: Time.zone.today,
end_voting_date: Time.zone.today + 1.month,
organization: organization,
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -82,7 +82,7 @@
start_voting_date: Time.zone.today - 2.months,
end_voting_date: Time.zone.today - 1.month,
organization: organization,
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -113,7 +113,7 @@
start_voting_date: Time.zone.today + 1.month + 1.day,
end_voting_date: Time.zone.today + 2.months,
organization: organization,
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -148,13 +148,13 @@
Decidim::Faker::Localized.paragraph(sentence_count: 3)
end,
organization: organization,
hero_image: ActiveStorage::Blob.create_after_upload!(
hero_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "hero_image.jpeg",
content_type: "image/jpeg",
metadata: nil
), # Keep after organization
banner_image: ActiveStorage::Blob.create_after_upload!(
banner_image: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city2.jpeg")),
filename: "banner_image.jpeg",
content_type: "image/jpeg",
Expand Down Expand Up @@ -188,7 +188,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: question,
content_type: "image/jpeg",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "city.jpeg")),
filename: "city.jpeg",
content_type: "image/jpeg",
Expand All @@ -201,7 +201,7 @@
description: Decidim::Faker::Localized.sentence(word_count: 5),
attached_to: question,
content_type: "application/pdf",
file: ActiveStorage::Blob.create_after_upload!(
file: ActiveStorage::Blob.create_and_upload!(
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
filename: "Exampledocument.pdf",
content_type: "application/pdf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module ParticipatorySpaceContext
#
# Returns nothing.
def participatory_space_layout(options = {})
layout :layout, options
before_action :authorize_participatory_space, options
layout :layout, **options
before_action :authorize_participatory_space, **options
end
end

Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/helpers/decidim/attachments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module AttachmentsHelper
#
# Returns nothing.
def attachments_for(attached_to)
render partial: "decidim/application/attachments.html", locals: { attached_to: attached_to }
render partial: "decidim/application/attachments", locals: { attached_to: attached_to }
end

# Renders the attachment's title.
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/helpers/decidim/followable_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Decidim
module FollowableHelper
# Invokes the decidim/shared/follow_button partial.
def follow_button_for(model, large = nil)
render partial: "decidim/shared/follow_button.html", locals: { followable: model, large: large }
render partial: "decidim/shared/follow_button", locals: { followable: model, large: large }
end
end
end
4 changes: 2 additions & 2 deletions decidim-core/app/mailers/decidim/newsletter_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
module Decidim
class NewsletterMailer < ApplicationMailer
helper Decidim::SanitizeHelper
helper Decidim::TranslationsHelper

include Decidim::NewslettersHelper

layout "decidim/newsletter_base"

add_template_helper Decidim::TranslationsHelper

helper_method :cell

def newsletter(user, newsletter)
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/presenters/decidim/menu_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize(menu_item, view, options = {})
def render
content_tag :li, class: link_wrapper_classes do
output = [link_to(composed_label, url)]
output.push(@view.send(:simple_menu, @menu_item.submenu).render) if @menu_item.submenu
output.push(@view.send(:simple_menu, **@menu_item.submenu).render) if @menu_item.submenu

safe_join(output)
end
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/services/decidim/traceability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def perform_action!(action, resource, author, extra_log_info = {})
result = block_given? ? yield : nil
loggable_resource = resource.is_a?(Class) ? result : resource
log(action, author, loggable_resource, extra_log_info)
return result
result
end
end
end
Expand Down

0 comments on commit d631326

Please sign in to comment.