pg_rails 7.0.8.pre.alpha.107 → 7.0.8.pre.alpha.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f5edf4d4749811c99ded6408e1b226c551629bac864ba616c3887505b2239fb
4
- data.tar.gz: f6f158eb4fdc879080ea5d349de6ad5ecebe42136ffca60ec87787210939b4c5
3
+ metadata.gz: 5174c715d280ab0c7e5581bd88d2e6cf7ee11507fc739f6369d959fc6d858acd
4
+ data.tar.gz: 87f88575ab82c80780fd12a5a65a7dc8c308d5aa828451cdd010121bf9ea8e00
5
5
  SHA512:
6
- metadata.gz: a6338a8c896422e27b9879d5b3bcdb871406c6d11c51858671d5eb7cd8da950da4637c3eadb0a8c2a3c8d55f6256e8ba5045f96e60bfcb949ce3a0f66f03d16a
7
- data.tar.gz: 5208e12befd8c75cfe1e3b51ced749857259a239c07fe461c9daccd1261e3532683d241a66176ef051fd74fc9e33b370aa0eecdc45d4143b32732ef9c696b678
6
+ metadata.gz: badbc2f74fe7d8b706e9cb2c38284dd92a99f43732fb8162449094ac3b9627d03a91245351e2eb7a1286acf50a82991584ae04ce777326eba975c43e3626d187
7
+ data.tar.gz: a2b4ad07bfe5398f89c76490caaa092253f0956d2d7762d6800d99d0bc483cdff7e22a528f3159f6277ab9fdad3b3922e181b29909c66e1a48dd1c922898c7be
@@ -11,7 +11,7 @@ module PgEngine
11
11
  end
12
12
 
13
13
  def configure_permitted_parameters
14
- devise_parameter_sanitizer.permit(:sign_up, keys: %i[nombre apellido])
14
+ devise_parameter_sanitizer.permit(:sign_up, keys: %i[nombre apellido accept_terms])
15
15
  devise_parameter_sanitizer.permit(:account_update, keys: %i[nombre apellido])
16
16
  end
17
17
  end
@@ -34,7 +34,6 @@ module PgEngine
34
34
  end
35
35
 
36
36
  def html_status(color:)
37
- # rubocop:disable Rails/OutputSafety
38
37
  %(<!DOCTYPE html><html><body style="background-color: #{color}"></body></html>).html_safe
39
38
  # rubocop:enable Rails/OutputSafety
40
39
  end
@@ -87,7 +87,6 @@ module PgEngine
87
87
  fields: fields.gsub("\n", '')
88
88
  }
89
89
  ) do
90
- # rubocop:disable Rails/OutputSafety
91
90
  "<i class=\"bi bi-plus-lg\"></i> #{name}".html_safe
92
91
  # rubocop:enable Rails/OutputSafety
93
92
  end
@@ -34,7 +34,7 @@ class PgFormBuilder < SimpleForm::FormBuilder
34
34
  base_message = (base_errors.map(&:to_s).join('<br>') if base_errors.present?)
35
35
  base_tag = error_notification(message: base_message, class: 'alert alert-danger') if base_message
36
36
 
37
- "#{title}#{base_tag}".html_safe # rubocop:disable Rails/OutputSafety
37
+ "#{title}#{base_tag}".html_safe
38
38
  end
39
39
 
40
40
  def mensaje
@@ -50,6 +50,10 @@ class User < ApplicationRecord
50
50
  validates_length_of :password, if: :password_required?, within: 6..128,
51
51
  message: 'es demasiado corta (6 caracteres mínimo)'
52
52
 
53
+ validates :accept_terms, acceptance: {
54
+ message: 'Para crear una cuenta es necesario que aceptes los términos y condiciones'
55
+ }
56
+
53
57
  attr_accessor :orphan
54
58
 
55
59
  after_create do
@@ -11,6 +11,7 @@ es:
11
11
  confirmed_at: Fecha de confirmación
12
12
  actualizado_por: Actualizado por
13
13
  creado_por: Creado por
14
+ accept_terms: Acepto los <a href="/terminos_y_condiciones" target="_blank">Términos y condiciones</a>
14
15
  enumerize:
15
16
  email:
16
17
  status:
@@ -22,13 +22,33 @@ describe 'Al Registrarse' do
22
22
  fill_in 'user_apellido', with: Faker::Name.name
23
23
  fill_in 'user_password', with: 'admin123'
24
24
  fill_in 'user_password_confirmation', with: 'admin123'
25
+
26
+ accept_terms
27
+
25
28
  instance_exec('input[type=submit]', &find_scroll).click
29
+ end
30
+ end
31
+
32
+ context 'cuando acepta los términos' do
33
+ let(:accept_terms) do
34
+ check 'user_accept_terms'
35
+ end
36
+
37
+ it 'guarda el user' do
38
+ expect { subject }.to change(User, :count).by(1)
26
39
  expect(page).to have_text('Te enviamos un correo electrónico con instrucciones')
27
40
  end
28
41
  end
29
42
 
30
- it 'guarda el user' do
31
- expect { subject }.to change(User, :count).by(1)
43
+ context 'si no acepta los terms' do
44
+ let(:accept_terms) do
45
+ nil
46
+ end
47
+
48
+ it do
49
+ subject
50
+ expect(page).to have_text 'es necesario que aceptes los términos y condiciones'
51
+ end
32
52
  end
33
53
  end
34
54
 
@@ -34,7 +34,7 @@ class Navbar
34
34
  bar_data.map do |item|
35
35
  {
36
36
  title: item['name'],
37
- attributes: item['attributes']&.html_safe, # rubocop:disable Rails/OutputSafety
37
+ attributes: item['attributes']&.html_safe,
38
38
  path: eval(item['path']),
39
39
  show: item['policy'] ? eval(item['policy']) : true
40
40
  }
@@ -16,6 +16,7 @@
16
16
  <%= f.input :password_confirmation,
17
17
  required: true,
18
18
  input_html: { autocomplete: "new-password" } %>
19
+ <%= f.input :accept_terms, as: :boolean, label: t('attributes.accept_terms').html_safe, error_prefix: '' %>
19
20
  </div>
20
21
 
21
22
  <div class="form-actions">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.107'
4
+ VERSION = '7.0.8-alpha.108'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.8.pre.alpha.107
4
+ version: 7.0.8.pre.alpha.108
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-01 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails