You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
815 B

  1. require 'rails_helper'
  2. RSpec.describe Auth::RegistrationsController, type: :controller do
  3. render_views
  4. describe 'GET #new' do
  5. before do
  6. request.env["devise.mapping"] = Devise.mappings[:user]
  7. end
  8. it 'returns http success' do
  9. get :new
  10. expect(response).to have_http_status(:success)
  11. end
  12. end
  13. describe 'POST #create' do
  14. before do
  15. request.env["devise.mapping"] = Devise.mappings[:user]
  16. post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678' } }
  17. end
  18. it 'redirects to home page' do
  19. expect(response).to redirect_to root_path
  20. end
  21. it 'creates user' do
  22. expect(User.find_by(email: 'test@example.com')).to_not be_nil
  23. end
  24. end
  25. end