hot-glue 0.7.8 → 0.7.9

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: 0e4491ce711db972625af0df18b41705f69a87451b34237a1a3ab1c565fc4729
4
- data.tar.gz: 13799e4f92016ccf6156abf90a85cd5bda7418b1287ce3d7c112112b853ff92f
3
+ metadata.gz: 76c922f98d4c719eebde65cdc53c37d2c8be4c77ef56790bc749332f3d65eefc
4
+ data.tar.gz: 32b2ae025eae1edd8f75a702c00efb9cad09797c72f9af56343c881d0850d9b9
5
5
  SHA512:
6
- metadata.gz: 32a835125c53bd4aa3d14080ac048c17d556db3b6db7716ce4a21eefba18db38fe33f76403e16f5e8a2f9415d6591430412d0a33029d0634ec65118f8363d345
7
- data.tar.gz: 55a21a7aba9909332640275d0b6cb24dcfb0784323eb9ca7e8248db70143ec4a6520f4c1537aa39c25ca36c4ac3f844ec42eab20e3345db3298915569c203897
6
+ metadata.gz: 4cb18544f2114c1633fd2c00ccfe8beecaed890a0e6fdfec5cd0bf6ebb536ef9a80d8cf586b4d5bf9baf6097afc8149380d77f85df04465b01872239f09033b7
7
+ data.tar.gz: 180a70ce42a44d9bf0f6919e689762dad6589530746e51e98d6b18fe8568d3c52f699859e715b2a3045c9240813ad6537a39a0f2416f8d7e8739da3e2e2d606e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.7.7)
4
+ hot-glue (0.7.8)
5
5
  ffaker (~> 2.16)
6
6
  rails (> 5.1)
7
7
 
data/README.md CHANGED
@@ -2489,6 +2489,11 @@ These automatic pickups for partials are detected at build time. This means that
2489
2489
 
2490
2490
  # VERSION HISTORY
2491
2491
 
2492
+ #### 2026-08-29 - v0.7.9
2493
+ -  Render float fields as type="number" step="any" for HTML5 validation; float fields should not be correctly validated on input
2494
+
2495
+ - switching 'feature' specs to be 'system' specs, switch to spec/system with shared DB connection, headless=new Chrome, and whole-example retry via rspec-retry; should address race conditions in specs
2496
+
2492
2497
  #### 2026-08-22 - v0.7.8
2493
2498
  - fix for time field output when no user is present (in gd mode)
2494
2499
  - in new builds, create and edit will now interact as turbo-stream interactions (except for big edit); this is to remove a race condition in the capy spec; note that your old edit.erb and new.erb will get deleted if you rebuild
@@ -171,13 +171,13 @@ class Field
171
171
  res
172
172
  end
173
173
 
174
- def field_output(type = nil, width )
174
+ def field_output(type = nil, width, step: nil)
175
175
  if modify_as && modify_as[:timezone]
176
176
  "<%= f.time_zone_select :#{name}, ActiveSupport::TimeZone.all, {}, {class: 'form-control'} %>"
177
177
  else
178
178
  parts = name.split('_')
179
179
  camelcase_name = parts.first + parts[1..].map(&:capitalize).join
180
- " <%= f.text_field :#{name}, value: #{singular}.#{name}, autocomplete: 'off', size: #{width}, class: 'form-control', type: '#{type}'" + (form_placeholder_labels ? ", placeholder: '#{name.to_s.humanize}'" : "") + (stimmify ? ", 'data-#{@stimmify}-target': '#{camelcase_name}' " : "") + " %>\n " + "\n"
180
+ " <%= f.text_field :#{name}, value: #{singular}.#{name}, autocomplete: 'off', size: #{width}, class: 'form-control', type: '#{type}'" + (step ? ", step: '#{step}'" : "") + (form_placeholder_labels ? ", placeholder: '#{name.to_s.humanize}'" : "") + (stimmify ? ", 'data-#{@stimmify}-target': '#{camelcase_name}' " : "") + " %>\n " + "\n"
181
181
  end
182
182
  end
183
183
 
@@ -11,7 +11,7 @@ class FloatField < Field
11
11
  end
12
12
 
13
13
  def form_field_output
14
- field_output(nil, 5)
14
+ field_output('number', 5, step: 'any')
15
15
  end
16
16
 
17
17
  # def line_field_output
@@ -56,6 +56,17 @@ module HotGlue
56
56
 
57
57
 
58
58
 
59
+ begin
60
+ gemfile_contents = File.read("Gemfile")
61
+ if !gemfile_contents.include?("rspec-retry")
62
+ gemfile_contents.gsub!(/^group :test do/, "group :test do\n gem \"rspec-retry\"")
63
+ File.write("Gemfile", gemfile_contents)
64
+ puts " HOTGLUE --> added to Gemfile: `gem \"rspec-retry\"` -- run `bundle install` "
65
+ end
66
+ rescue StandardError => e
67
+ puts "WARNING: error writing to Gemfile --- #{e.message}"
68
+ end
69
+
59
70
  begin
60
71
  rails_helper_contents = File.read("#{filepath_prefix}spec/rails_helper.rb")
61
72
  if !rails_helper_contents.include?("Capybara.default_driver =")
@@ -63,6 +74,11 @@ module HotGlue
63
74
  puts " HOTGLUE --> added to spec/rails_helper.rb: `Capybara.default_driver = :selenium_chrome_headless` "
64
75
  end
65
76
 
77
+ if !rails_helper_contents.include?("Capybara.default_max_wait_time")
78
+ rails_helper_contents << "\n\n# Default of 2s is too tight for headless Chrome + Devise + Turbo page\n# renders under load, causing sporadic false-negative waits.\nCapybara.default_max_wait_time = 5\n"
79
+ puts " HOTGLUE --> added to spec/rails_helper.rb: `Capybara.default_max_wait_time = 5` "
80
+ end
81
+
66
82
  if !rails_helper_contents.include?("include FactoryBot::Syntax::Methods")
67
83
  rails_helper_contents.gsub!("RSpec.configure do |config|", "RSpec.configure do |config| \n
68
84
  config.include FactoryBot::Syntax::Methods
@@ -70,9 +86,46 @@ module HotGlue
70
86
  puts " HOTGLUE --> added to #{filepath_prefix}spec/rails_helper.rb: `config.include FactoryBot::Syntax::Methods` "
71
87
  end
72
88
 
89
+ if !rails_helper_contents.include?("type: :system) do")
90
+ rails_helper_contents.gsub!("RSpec.configure do |config|", "RSpec.configure do |config| \n
91
+ # spec/system specs run through ActionDispatch::SystemTestCase, which shares
92
+ # the DB connection between the test thread and the in-process Puma server
93
+ # thread. Plain :feature specs with a real Selenium driver don't get this,
94
+ # which causes intermittent \"record not visible to the server thread\"
95
+ # failures (e.g. login appearing to fail right after the user was created).
96
+ #
97
+ # We use :chrome (not Rails' :headless_chrome) because
98
+ # ActionDispatch::SystemTesting::Browser hardcodes the legacy `--headless`
99
+ # flag. Legacy headless Chrome runs a materially different rendering/input
100
+ # pipeline than real Chrome and has known bugs where a native click never
101
+ # reaches the page. `--headless=new` (Chrome 109+) doesn't have this problem.
102
+ config.before(:each, type: :system) do
103
+ driven_by :selenium, using: :chrome, screen_size: [1366, 1200] do |options|
104
+ options.add_argument(\"--headless=new\")
105
+ end
106
+ end
107
+
108
+ # Real-browser system specs still hit transient, infrastructure-level
109
+ # flakiness that has nothing to do with application correctness (a click
110
+ # occasionally dropped by the browser, a Turbo navigation racing a
111
+ # Capybara content read into an error Capybara doesn't retry on its own).
112
+ # Retrying the whole example -- rather than chasing each transient error
113
+ # class individually -- is the standard fix for this. rspec-retry
114
+ # re-instantiates the example group on retry so `let`/`let!` factories
115
+ # actually re-run instead of reusing stale memoized state.
116
+ config.verbose_retry = true
117
+ config.default_retry_count = 3
118
+ config.retry_callback = proc { Capybara.reset_sessions! }
119
+ config.around(:each, type: :system) do |example|
120
+ example.run_with_retry retry: 3
121
+ end
122
+ ")
123
+ puts " HOTGLUE --> added to #{filepath_prefix}spec/rails_helper.rb: `config.before(:each, type: :system) { driven_by :selenium, using: :chrome, --headless=new }` and rspec-retry config "
124
+ end
125
+
73
126
  if ! rails_helper_contents.include?("require 'support/capybara_login.rb'")
74
- rails_helper_contents.gsub!("require 'rspec/rails'","require 'rspec/rails' \nrequire 'support/capybara_login.rb'")
75
- puts " HOTGLUE --> added to spec/rails_helper.rb: `require 'support/capybara_login.rb'` "
127
+ rails_helper_contents.gsub!("require 'rspec/rails'","require 'rspec/rails' \nrequire 'rspec/retry' \nrequire 'support/capybara_login.rb'")
128
+ puts " HOTGLUE --> added to spec/rails_helper.rb: `require 'rspec/retry'` and `require 'support/capybara_login.rb'` "
76
129
  end
77
130
  File.write("#{filepath_prefix}spec/rails_helper.rb", rails_helper_contents)
78
131
 
@@ -138,6 +191,7 @@ module HotGlue
138
191
  rescue StandardError => e
139
192
  puts "WARNING: error writing to #{Rails.env.test? ? 'spec/dummmy/' : ''}spec/support/capybara_login.rb --- #{e.message}"
140
193
  end
194
+
141
195
  end
142
196
  end
143
197
  end
@@ -1265,7 +1265,7 @@ class HotGlue::ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
1265
1265
  end
1266
1266
 
1267
1267
  unless @no_specs
1268
- dest_file = File.join("#{filepath_prefix}spec/features#{namespace_with_dash}", "#{plural}_behavior_spec.rb")
1268
+ dest_file = File.join("#{filepath_prefix}spec/system#{namespace_with_dash}", "#{plural}_behavior_spec.rb")
1269
1269
 
1270
1270
  if File.exist?(dest_file)
1271
1271
  existing_file = File.open(dest_file)
@@ -6,10 +6,5 @@ def login_as(user)
6
6
  end
7
7
  click_button 'Log in'
8
8
 
9
- # headless Chrome/Selenium occasionally drops this click without submitting
10
- # the form at all (confirmed via server log: no POST /users/sign_in received).
11
- # Retry once before failing for real.
12
- click_button 'Log in' unless page.has_content?('Signed in successfully', wait: 3)
13
-
14
9
  expect(page).to have_content("Signed in successfully")
15
10
  end
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.7.8'
3
+ CURRENT = '0.7.9'
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ rm -rf dummy/app/views/humans/*
19
19
  rm -rf dummy/app/views/pets/*
20
20
 
21
21
  /bin/rm -rf dummy/spec/features/
22
+ /bin/rm -rf dummy/spec/system/
22
23
 
23
24
 
24
25
  # !("application_controller.rb"|"welcome_controller.rb")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-22 00:00:00.000000000 Z
11
+ date: 2026-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails