Sha256: 87da1d25add6863dc4a5e2a67d51ba1056ffa923d966f60f6fbbb42826be8799

Contents?: true

Size: 1.35 KB

Versions: 102

Compression:

Stored size: 1.35 KB

Contents

require 'rails_helper'

describe Users::RegistrationsController do
  render_views

  before do
    # rubocop:disable RSpec/InstanceVariable
    @request.env['devise.mapping'] = Devise.mappings[:user]
    # rubocop:enable RSpec/InstanceVariable
  end

  describe '#new' do
    subject { get :new }

    it do
      subject
      expect(response).to have_http_status(:ok)
    end
  end

  describe '#create' do
    subject do
      post :create, params: { user: { nombre:, apellido:, email:, password:, password_confirmation: } }
    end

    let(:nombre) { Faker::Name.first_name }
    let(:apellido) { Faker::Name.last_name }
    let(:email) { Faker::Internet.email }
    let(:password) { '123123' }
    let(:password_confirmation) { password }

    it do
      expect { subject }.to change(User, :count).by(1)
    end

    it do
      subject
      expect(response.body).to include I18n.t('devise.registrations.signed_up_but_unconfirmed')
    end

    context 'cuando no coinciden los passwords' do
      let(:password_confirmation) { 'bla' }

      it do
        subject
        expect(response).not_to be_successful
      end
    end
  end

  describe '#edit' do
    subject { get :edit }

    let(:logger_user) { create :user, :admin }

    before do
      sign_in logger_user
    end

    it do
      subject
      expect(response).to have_http_status(:ok)
    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
pg_rails-7.0.8.pre.alpha.43 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.42 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.41 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.40 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.39 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.38 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.37 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.36 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.35 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.34 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.33 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.32 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.31 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.30 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.29 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.28 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.27 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.26 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.25 pg_engine/spec/controllers/users/registrations_controller_spec.rb
pg_rails-7.0.8.pre.alpha.24 pg_engine/spec/controllers/users/registrations_controller_spec.rb