-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from YukiWatanabe824/feat/add_request_spec
リクエストスペックの追加
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'AdminUserAuthorizations', type: :request do | ||
let(:regular_user) { FactoryBot.create(:user, :not_admin_user) } | ||
let(:other_user) { FactoryBot.create(:user, :admin_user) } | ||
let(:spot) { FactoryBot.create(:spot, :make_by_standard_user) } | ||
|
||
describe 'GET edit_admins_user_path' do | ||
it 'regular user cant access to editer for admin' do | ||
sign_in regular_user | ||
get edit_admins_user_path(regular_user) | ||
expect(response).to have_http_status '404' | ||
end | ||
end | ||
|
||
describe 'DELETE admins_user_path' do | ||
it 'regular user cant delete other user' do | ||
sign_in regular_user | ||
delete admins_user_path(other_user) | ||
expect(response).to have_http_status '404' | ||
end | ||
end | ||
|
||
describe 'PUT admins_user_path' do | ||
it 'regular user cant edit myself by admins path' do | ||
sign_in regular_user | ||
put admins_user_path(regular_user) | ||
expect(response).to have_http_status '404' | ||
end | ||
end | ||
|
||
describe 'PUT admins_spot_path' do | ||
it 'regular user cant edit myspot by admins path' do | ||
sign_in regular_user | ||
put admins_spot_path(spot) | ||
expect(response).to have_http_status '404' | ||
end | ||
end | ||
|
||
describe 'DELETE admins_spot_path' do | ||
it 'regular user cant delete myspot by admins pass' do | ||
sign_in regular_user | ||
delete admins_spot_path(spot) | ||
expect(response).to have_http_status '404' | ||
end | ||
end | ||
end |