REFACTOR: admin screened urls controller specs to requests (#5976)

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

View File

@ -5,18 +5,17 @@ describe Admin::ScreenedUrlsController do
expect(Admin::ScreenedUrlsController < Admin::AdminController).to eq(true) expect(Admin::ScreenedUrlsController < 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_url)
get "/admin/logs/screened_urls.json"
expect(response.status).to eq(200)
json = JSON.parse(response.body)
expect(json.size).to eq(1)
end end
end end
end end