Do not exchange XMPP contacts when turned off by inviter
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
This commit is contained in:
@@ -139,6 +139,8 @@ RSpec.describe User, type: :model do
|
||||
let(:guest) { create :user, id: 2, cn: "isaacnewton", ou: "kosmos.org", email: "newt@example.com" }
|
||||
|
||||
before do
|
||||
# TODO remove when defaults are implemented
|
||||
user.update! preferences: {"xmpp" => { "exchange_contacts_with_invitees" => true }}
|
||||
Invitation.create! user: user, invited_user_id: guest.id, used_at: DateTime.now
|
||||
allow_any_instance_of(User).to receive(:enable_service).and_return(true)
|
||||
end
|
||||
@@ -147,6 +149,17 @@ RSpec.describe User, type: :model do
|
||||
expect(guest).to receive(:exchange_xmpp_contact_with_inviter)
|
||||
guest.send(:devise_after_confirmation)
|
||||
end
|
||||
|
||||
context "automatic contact exchange disabled" do
|
||||
before do
|
||||
user.update! preferences: {"xmpp" => { "exchange_contacts_with_invitees" => false }}
|
||||
end
|
||||
|
||||
it "does not exchange XMPP contacts with the inviter" do
|
||||
expect(guest).to_not receive(:exchange_xmpp_contact_with_inviter)
|
||||
guest.send(:devise_after_confirmation)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user