Sha256: 946baa72fa169f22282e79fcf63544d69dafe851de09b86213572c0e5257afbb

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe Decidim::FileAuthorizationHandler::RemoveDuplicatesJob do
  let(:org_1) { create :organization }
  let(:org_2) { create :organization }

  it "remove duplicates in the database" do
    %w(AAA BBB AAA AAA).each do |doc|
      create(:census_datum, id_document: doc, organization: org_1)
      create(:census_datum, id_document: doc, organization: org_2)
    end
    expect(Decidim::FileAuthorizationHandler::CensusDatum.count).to be 8
    described_class.new.perform org_1
    expect(Decidim::FileAuthorizationHandler::CensusDatum.count).to be 6
    described_class.new.perform org_2
    expect(Decidim::FileAuthorizationHandler::CensusDatum.count).to be 4
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-file_authorization_handler-0.27.1.7 spec/jobs/decidim/file_authorization_handler/remove_duplicates_job_spec.rb
decidim-file_authorization_handler-0.27.1.6 spec/jobs/decidim/file_authorization_handler/remove_duplicates_job_spec.rb
decidim-file_authorization_handler-0.27.1.5 spec/jobs/decidim/file_authorization_handler/remove_duplicates_job_spec.rb