tests and UI changes

This commit is contained in:
Karol Selak 2021-03-22 04:19:37 +01:00
parent de29815686
commit f7ec73f85e
6 changed files with 32 additions and 33 deletions

View file

@ -3,11 +3,22 @@
require 'rails_helper'
RSpec.describe UsersController do
before(:all) do # TODO: change it to cleanup after each test
before(:all) do # TODO: turn it into cleanup after each test
User.destroy_all
end
let(:user1) do
User.create(email: 'test1@example.com', password: 'abcdefgh', recovery_password: 'recovery password')
User.create(
email: 'test1@example.com',
password: 'abcdefgh',
recovery_password: 'recovery password',
role: :admin
)
end
describe 'get index' do
subject { get :index }
it 'renders the users/index template' do
expect(subject).to render_template('users/index')
end
end
describe 'get new' do
subject { get :new }
@ -106,4 +117,11 @@ RSpec.describe UsersController do
end
end
end
describe 'delete destroy' do
context 'when admin is logged in' do
it 'deletes the user' do
# TODO
end
end
end
end