2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-10 17:27:01 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-08-24 11:01:11 +08:00
|
|
|
RSpec.describe Admin::AdminController do
|
2018-06-11 12:32:55 +08:00
|
|
|
describe '#index' do
|
|
|
|
it "needs you to be logged in" do
|
|
|
|
get "/admin.json"
|
|
|
|
expect(response.status).to eq(404)
|
|
|
|
end
|
2018-02-01 09:26:45 +08:00
|
|
|
|
2018-06-11 12:32:55 +08:00
|
|
|
it "should return the right response if user isn't a staff" do
|
|
|
|
sign_in(Fabricate(:user))
|
|
|
|
get "/admin", params: { api_key: 'asdiasiduga' }
|
|
|
|
expect(response.status).to eq(404)
|
|
|
|
|
|
|
|
get "/admin"
|
|
|
|
expect(response.status).to eq(404)
|
|
|
|
end
|
2017-08-10 17:27:01 +08:00
|
|
|
end
|
|
|
|
end
|