namespace :proposals do

  desc "Move external_url to description"
  task move_external_url_to_description: :environment do
    include ActionView::Helpers::SanitizeHelper
    include TextWithLinksHelper

    models = [Proposal, Legislation::Proposal]

    models.each do |model|
      print "Move external_url to description for #{model}s"
      model.find_each do |resource|
        if resource.external_url.present?
          resource.update_columns(description: "#{resource.description} "\
                                  "<p>#{text_with_links(resource.external_url)}</p>",
                                  external_url: "", updated_at: Time.current)
          print "."
        end
      end
      puts " ✅ "
    end
  end
end

namespace :proposals do

  desc "Move external_url to description"
  task move_external_url_to_description: :environment do
    include ActionView::Helpers::SanitizeHelper
    include TextWithLinksHelper

    models = [Proposal, Legislation::Proposal]

    models.each do |model|
      print "Move external_url to description for #{model}s"
      model.find_each do |resource|
        if resource.external_url.present?
          Globalize.with_locale(I18n.default_locale) do
            new_description = "#{resource.description} <p>#{text_with_links(resource.external_url)}</p>"
            resource.description = new_description
            resource.external_url = ""
            resource.updated_at = Time.current
            resource.save(validate: false)
            print "."
          end
        end
      end
      puts " ✅ "
    end
  end
end

Fix specs after rebase with translations branch
Fix specs after rebase with translations branch

- Fix spec spec/features/management/proposals_spec.rb:24 adding single quotes.
- Remove spec related with 'proposal improvement info link' as master branch.
- Fix proposal rake task (now proposals have translations). We put the 'validate: false' to keep the existing html tags in the  proposal's description. Without the sanitizable module deleting them.
