Allow Mastodon address domain to be different from primary domain
This commit is contained in:
@@ -12,6 +12,38 @@ RSpec.describe User, type: :model do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#mastodon_address" do
|
||||
let(:user) { build :user, cn: "jimmy", ou: "kosmos.org" }
|
||||
|
||||
context "Mastodon service not configured" do
|
||||
it "returns nil" do
|
||||
expect(user.mastodon_address).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context "Mastodon service configured" do
|
||||
before do
|
||||
Setting.mastodon_enabled = true
|
||||
end
|
||||
|
||||
describe "domain is the same as primary domain" do
|
||||
it "returns the user address" do
|
||||
expect(user.mastodon_address).to eq("jimmy@kosmos.org")
|
||||
end
|
||||
end
|
||||
|
||||
describe "domain is different from primary domain" do
|
||||
before do
|
||||
Setting.mastodon_address_domain = "kosmos.social"
|
||||
end
|
||||
|
||||
it "returns the user address" do
|
||||
expect(user.mastodon_address).to eq("jimmy@kosmos.social")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#is_admin?" do
|
||||
it "returns true when admin flag is set in LDAP" do
|
||||
expect(Devise::LDAP::Adapter).to receive(:get_ldap_param)
|
||||
|
||||
Reference in New Issue
Block a user