REFACTOR: admin screened emails controller specs to requests (#5975)

This commit is contained in:
OsamaSayegh 2018-06-11 07:33:54 +03:00 committed by Guo Xiang Tan
parent f30c2dacb2
commit 237559c76f
1 changed files with 7 additions and 8 deletions

View File

@ -5,18 +5,17 @@ describe Admin::ScreenedEmailsController do
expect(Admin::ScreenedEmailsController < Admin::AdminController).to eq(true) expect(Admin::ScreenedEmailsController < Admin::AdminController).to eq(true)
end end
let!(:user) { log_in(:admin) } describe '#index' do
context '.index' do
before do before do
get :index, format: :json sign_in(Fabricate(:admin))
end end
subject { response }
it { is_expected.to be_successful }
it 'returns JSON' do it 'returns JSON' do
expect(::JSON.parse(subject.body)).to be_a(Array) Fabricate(:screened_email)
get "/admin/logs/screened_emails.json"
expect(response.status).to eq(200)
json = JSON.parse(response.body)
expect(json.size).to eq(1)
end end
end end
end end