discourse/spec/controllers/admin/email_logs_controller_spec.rb

38 lines
781 B
Ruby
Raw Normal View History

2013-02-05 14:16:51 -05:00
require 'spec_helper'
describe Admin::EmailLogsController do
it "is a subclass of AdminController" do
(Admin::EmailLogsController < Admin::AdminController).should be_true
end
let!(:user) { log_in(:admin) }
context '.index' do
2013-02-25 11:42:20 -05:00
before do
2013-02-05 14:16:51 -05:00
xhr :get, :index
end
subject { response }
it { should be_success }
end
context '.test' do
it 'raises an error without the email parameter' do
lambda { xhr :post, :test }.should raise_error(Discourse::InvalidParameters)
end
context 'with an email address' do
it 'enqueues a test email job' do
2013-02-25 11:42:20 -05:00
Jobs.expects(:enqueue).with(:test_email, to_address: 'eviltrout@test.domain')
2013-02-05 14:16:51 -05:00
xhr :post, :test, email_address: 'eviltrout@test.domain'
end
end
end
2013-02-25 11:42:20 -05:00
end