闭社主体 forked from https://github.com/tootsuite/mastodon
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.

33 lines
908 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. Setting.open_registrations = true
  7. request.env["devise.mapping"] = Devise.mappings[:user]
  8. end
  9. it 'returns http success' do
  10. get :new
  11. expect(response).to have_http_status(:success)
  12. end
  13. end
  14. describe 'POST #create' do
  15. before do
  16. Setting.open_registrations = true
  17. request.env["devise.mapping"] = Devise.mappings[:user]
  18. post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678' } }
  19. end
  20. it 'redirects to login page' do
  21. expect(response).to redirect_to new_user_session_path
  22. end
  23. it 'creates user' do
  24. expect(User.find_by(email: 'test@example.com')).to_not be_nil
  25. end
  26. end
  27. end