From 237559c76f1aaa22be859ddf16317883bc698d59 Mon Sep 17 00:00:00 2001 From: OsamaSayegh Date: Mon, 11 Jun 2018 07:33:54 +0300 Subject: [PATCH] REFACTOR: admin screened emails controller specs to requests (#5975) --- .../admin/screened_emails_controller_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) rename spec/{controllers => requests}/admin/screened_emails_controller_spec.rb (51%) diff --git a/spec/controllers/admin/screened_emails_controller_spec.rb b/spec/requests/admin/screened_emails_controller_spec.rb similarity index 51% rename from spec/controllers/admin/screened_emails_controller_spec.rb rename to spec/requests/admin/screened_emails_controller_spec.rb index bd0503a60cc..8d9ce25032f 100644 --- a/spec/controllers/admin/screened_emails_controller_spec.rb +++ b/spec/requests/admin/screened_emails_controller_spec.rb @@ -5,18 +5,17 @@ describe Admin::ScreenedEmailsController do expect(Admin::ScreenedEmailsController < Admin::AdminController).to eq(true) end - let!(:user) { log_in(:admin) } - - context '.index' do + describe '#index' do before do - get :index, format: :json + sign_in(Fabricate(:admin)) end - subject { response } - it { is_expected.to be_successful } - 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