Skip to content

Commit 4be6a38

Browse files
Add test
1 parent 9efb483 commit 4be6a38

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/serializers/decidim/extra_user_fields/user_export_serializer_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@
6767
expect(serialized).to include(location: resource.extended_data["location"])
6868
end
6969

70+
context "when users are blocked" do
71+
let(:resource) { create(:user, :blocked, extended_data: registration_metadata, blocked_at:) }
72+
let(:blocked_at) { Time.zone.now }
73+
let(:blocking_user) { create(:user, :admin, :confirmed, organization: resource.organization) }
74+
let(:blocking_justification) { "This is a spam user with suspicious activities" }
75+
let(:user_block) { double(justification: blocking_justification) }
76+
77+
before do
78+
allow(resource).to receive(:blocking).and_return(user_block)
79+
end
80+
81+
it "includes the blocked status and justification" do
82+
expect(serialized).to include(blocked: true)
83+
expect(serialized).to include(blocked_at:)
84+
expect(serialized).to include(blocking_justification:)
85+
end
86+
end
87+
7088
# Block ExtraUserFields IncludeExtraField
7189

7290
# EndBlock

0 commit comments

Comments
 (0)