Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
).each do |version|
appraise "rails-#{version}" do
gem "rails", "~> #{version}.0"

# NOTE: concurrent-ruby gem no longer loads the logger gem since v1.3.5.
# More info: https://github.com/rails/rails/pull/54264
gem "concurrent-ruby", "< 1.3.5"
end
end
1 change: 1 addition & 0 deletions gemfiles/rails_5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source "https://rubygems.org"

gem "rails", "~> 5.2.0"
gem "concurrent-ruby", "< 1.3.5"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source "https://rubygems.org"

gem "rails", "~> 6.0.0"
gem "concurrent-ruby", "< 1.3.5"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source "https://rubygems.org"

gem "rails", "~> 6.1.0"
gem "concurrent-ruby", "< 1.3.5"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source "https://rubygems.org"

gem "rails", "~> 7.0.0"
gem "concurrent-ruby", "< 1.3.5"

gemspec path: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source "https://rubygems.org"

gem "rails", "~> 7.1.0"
gem "concurrent-ruby", "< 1.3.5"

gemspec path: "../"
6 changes: 1 addition & 5 deletions lib/invisible_captcha/view_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def invisible_captcha(honeypot = nil, scope = nil, options = {})
end

if InvisibleCaptcha.spinner_enabled && @captcha_ocurrences == 1
session[:invisible_captcha_spinner] = InvisibleCaptcha.encode("#{session[:invisible_captcha_timestamp]}-#{current_request.remote_ip}")
session[:invisible_captcha_spinner] = InvisibleCaptcha.encode("#{session[:invisible_captcha_timestamp]}-#{request.remote_ip}")
end

build_invisible_captcha(honeypot, scope, options)
Expand All @@ -32,10 +32,6 @@ def invisible_captcha_styles

private

def current_request
@request ||= request
end

def build_invisible_captcha(honeypot = nil, scope = nil, options = {})
if honeypot.is_a?(Hash)
options = honeypot
Expand Down
5 changes: 5 additions & 0 deletions spec/view_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
# to test content_for and provide
@view_flow = ActionView::OutputFlow.new

# mock request object for Rails < 7.0
if Rails.version < '7.0'
allow(request).to receive(:remote_ip).and_return('0.0.0.0')
end

InvisibleCaptcha.init!
end

Expand Down
Loading