Consider the current tenant with delayed jobs
This commit is contained in:
committed by
Javi Martín
parent
275ddb08d8
commit
52ebeb7ba6
@@ -51,4 +51,23 @@ describe Mailer do
|
||||
expect(user.subscriptions_token).to eq "subscriptions_token_value"
|
||||
end
|
||||
end
|
||||
|
||||
describe "multitenancy" do
|
||||
it "uses the current tenant when using delayed jobs", :delay_jobs do
|
||||
allow(ActionMailer::Base).to receive(:default_url_options).and_return({ host: "consul.dev" })
|
||||
create(:tenant, schema: "delay")
|
||||
|
||||
Tenant.switch("delay") do
|
||||
Setting["org_name"] = "Delayed tenant"
|
||||
|
||||
Mailer.delay.user_invite("test@consul.dev")
|
||||
end
|
||||
|
||||
Delayed::Worker.new.work_off
|
||||
body = ActionMailer::Base.deliveries.last.body.to_s
|
||||
expect(body).to match "Delayed tenant"
|
||||
expect(body).to match "href=\"http://delay.consul.dev/"
|
||||
expect(body).to match "src=\"http://delay.consul.dev/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user