diff --git a/spec/commands/concerns/decidim/privacy/admin/create_participatory_space_private_user_extensions_spec.rb b/spec/commands/concerns/decidim/privacy/admin/create_participatory_space_private_user_extensions_spec.rb new file mode 100644 index 0000000..7a40ca2 --- /dev/null +++ b/spec/commands/concerns/decidim/privacy/admin/create_participatory_space_private_user_extensions_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe Decidim::Privacy::Admin::CreateParticipatorySpacePrivateUserExtensions do + subject { Decidim::Admin::CreateParticipatorySpacePrivateUser.new(form, current_user, privatable_to, via_csv:) } + + let!(:via_csv) { false } + let!(:privatable_to) { create(:participatory_process) } + let!(:email) { "my_email@example.org" } + let!(:name) { "Weird Guy" } + let!(:user) { create(:user, email: "my_email@example.org", organization: privatable_to.organization) } + let!(:current_user) { create(:user, email: "some_email@example.org", organization: privatable_to.organization) } + let!(:form) do + double( + invalid?: invalid, + delete_current_private_participants?: delete, + email:, + current_user:, + name: + ) + end + let(:delete) { false } + let(:invalid) { false } + + it "finds private users" do + expect(subject.send(:existing_user)).to eq(user) + end +end