Skip to content

Commit

Permalink
bundle update
Browse files Browse the repository at this point in the history
  • Loading branch information
gdonald committed Dec 30, 2023
1 parent cde150b commit d671ca0
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.3.0
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source 'https://rubygems.org'

ruby '3.2.2'
ruby '3.3.0'

gem 'aasm', '~> 5.5.0'
gem 'activeadmin', '~> 3.1.0'
gem 'activeadmin', '~> 3.2.0'
gem 'after_commit_everywhere', '~> 1.0'
gem 'bcrypt', '~> 3.1.7'
gem 'bootstrap5-kaminari-views', '~> 0.0.1'
Expand All @@ -17,7 +17,7 @@ gem 'jbuilder'
gem 'jsbundling-rails'
gem 'jwt', '~> 2.7.1'
gem 'kaminari', '~> 1.2.2'
gem 'nokogiri', '~> 1.15.4'
gem 'nokogiri', '~> 1.16.0'
gem 'pg', '~> 1.1'
gem 'pg_search', '~> 2.3.6'
gem 'puma', '>= 5.0'
Expand Down Expand Up @@ -57,7 +57,7 @@ end
group :test do
gem 'capybara'
gem 'selenium-webdriver'
gem 'shoulda-matchers', '~> 5.3.0'
gem 'shoulda-matchers', '~> 6.0.0'
gem 'simplecov', require: false
gem 'webmock'
end
68 changes: 32 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GEM
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activeadmin (3.1.0)
activeadmin (3.2.0)
arbre (~> 1.2, >= 1.2.1)
formtastic (>= 3.1)
formtastic_i18n (>= 0.4)
Expand Down Expand Up @@ -100,12 +100,13 @@ GEM
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.0)
bigdecimal (3.1.4)
bigdecimal (3.1.5)
bindex (0.8.1)
bootstrap5-kaminari-views (0.0.1)
kaminari (>= 0.13)
rails (>= 3.1)
brakeman (6.1.0)
brakeman (6.1.1)
racc
builder (3.2.4)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
Expand Down Expand Up @@ -140,9 +141,9 @@ GEM
cssbundling-rails (1.3.3)
railties (>= 6.0.0)
date (3.3.4)
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.0)
docile (1.4.0)
dotenv (2.8.1)
Expand All @@ -155,9 +156,9 @@ GEM
erubi (1.12.0)
et-orbi (1.2.7)
tzinfo
factory_bot (6.4.2)
factory_bot (6.4.5)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.2)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
railties (>= 5.0.0)
ffi (1.16.3)
Expand All @@ -172,7 +173,7 @@ GEM
has_scope (0.8.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
hashdiff (1.0.1)
hashdiff (1.1.0)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
Expand All @@ -186,8 +187,8 @@ GEM
has_scope (>= 0.6)
railties (>= 6.0)
responders (>= 2)
io-console (0.6.0)
irb (1.10.1)
io-console (0.7.1)
irb (1.11.0)
rdoc
reline (>= 0.3.8)
jbuilder (2.11.5)
Expand Down Expand Up @@ -231,7 +232,7 @@ GEM
minitest (5.20.0)
multi_xml (0.6.0)
mutex_m (0.2.0)
net-imap (0.4.7)
net-imap (0.4.9)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -242,18 +243,14 @@ GEM
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.4.0)
net-protocol
net-ssh (7.2.0)
net-ssh (7.2.1)
nio4r (2.7.0)
nokogiri (1.15.5)
nokogiri (1.16.0)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.15.5-aarch64-linux)
racc (~> 1.4)
nokogiri (1.15.5-arm64-darwin)
nokogiri (1.16.0-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
parallel (1.23.0)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
Expand All @@ -264,7 +261,7 @@ GEM
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.1.1)
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.0)
Expand Down Expand Up @@ -316,11 +313,11 @@ GEM
i18n
rbnacl (7.1.1)
ffi
rdoc (6.6.1)
rdoc (6.6.2)
psych (>= 4.0.0)
redis (5.0.8)
redis-client (>= 0.17.0)
redis-client (0.19.0)
redis-client (0.19.1)
connection_pool
regexp_parser (2.8.3)
reline (0.4.1)
Expand All @@ -346,7 +343,7 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.58.0)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -363,7 +360,7 @@ GEM
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rails (2.22.2)
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down Expand Up @@ -391,7 +388,7 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
shoulda-matchers (5.3.0)
shoulda-matchers (6.0.0)
activesupport (>= 5.2.0)
sidekiq (7.2.0)
concurrent-ruby (< 2)
Expand All @@ -415,7 +412,8 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sshkit (1.21.6)
sshkit (1.21.7)
mutex_m
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stimulus-rails (1.3.0)
Expand Down Expand Up @@ -450,14 +448,12 @@ GEM
zeitwerk (2.6.12)

PLATFORMS
aarch64-linux
arm64-darwin-22
x86_64-freebsd-14
x86_64-linux
arm64-darwin-23
ruby

DEPENDENCIES
aasm (~> 5.5.0)
activeadmin (~> 3.1.0)
activeadmin (~> 3.2.0)
after_commit_everywhere (~> 1.0)
bcrypt (~> 3.1.7)
bcrypt_pbkdf
Expand All @@ -479,7 +475,7 @@ DEPENDENCIES
jsbundling-rails
jwt (~> 2.7.1)
kaminari (~> 1.2.2)
nokogiri (~> 1.15.4)
nokogiri (~> 1.16.0)
pg (~> 1.1)
pg_search (~> 2.3.6)
pry
Expand All @@ -495,7 +491,7 @@ DEPENDENCIES
rubocop-rspec
sassc-rails (~> 2.1.2)
selenium-webdriver
shoulda-matchers (~> 5.3.0)
shoulda-matchers (~> 6.0.0)
sidekiq (~> 7.2.0)
sidekiq-cron (~> 1.12.0)
simplecov
Expand All @@ -506,7 +502,7 @@ DEPENDENCIES
webmock

RUBY VERSION
ruby 3.2.2p53
ruby 3.3.0p0

BUNDLED WITH
2.4.20
2.5.3
18 changes: 9 additions & 9 deletions app/services/remote_search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ def search

def request
RequestEncoderService.new(term).encode
# rescue StandardError
# Rails.logger.error('Failed to encode request')
# nil
rescue StandardError
Rails.logger.error('Failed to encode request')
nil
end

def response
r = request
HTTParty.post(url, body: r[:body], headers: r[:headers])
# rescue StandardError
# Rails.logger.error('Remote request failed')
# nil
rescue StandardError
Rails.logger.error('Remote request failed')
nil
end

def json
JSON.parse(response.body)
# rescue StandardError
# Rails.logger.error('Failed to parse response body')
# nil
rescue StandardError
Rails.logger.error('Failed to parse response body')
nil
end
end
9 changes: 6 additions & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
end
RSpec.configure do |config|
config.before(:each, type: :system) do
driver = :selenium_chrome_headless
driver = :selenium_chrome if ENV['SHOW_CHROME']
driven_by(driver)
# driver = :selenium_chrome_headless
# driver = :selenium_chrome if ENV['SHOW_CHROME']
using = :headless_firefox
using = :firefox if ENV['SHOW_FF']
using = :chrome if ENV['SHOW_CHROME']
driven_by(:selenium, using:)
end

config.include FactoryBot::Syntax::Methods
Expand Down
4 changes: 1 addition & 3 deletions spec/requests/api/searches_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@

allow(pkey).to receive(:sign)

allow(JWT).to receive(:encode).and_return(data)

allow(JWT).to receive(:decode).and_return([{ 'q' => 'foo' }, { 'alg' => algorithm }])
allow(JWT).to receive_messages(encode: data, decode: [{ 'q' => 'foo' }, { 'alg' => algorithm }])
end

it 'returns http success' do
Expand Down
24 changes: 15 additions & 9 deletions spec/services/remote_search_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
allow(ENV).to receive(:fetch).with('USER_AGENT', 'Example/1.0 (https://example.com)').and_return('user_agent')
allow(OpenSSL::PKey::RSA).to receive(:new)
allow(JWT).to receive(:encode).and_return('data')
# allow(HTTParty).to receive(:post).and_return(double(body:))
allow(RequestUrl).to receive(:url).and_return('http://example.com:3000/api/search')
end

context 'with no server' do
it 'returns an empty array' do
it 'returns an empty array' do # rubocop:disable RSpec/ExampleLength
stub_request(:post, 'http://example.com:3000/api/search')
.with(
body: '{"data":"data","algorithm":"algorithm"}',
Expand All @@ -41,7 +40,7 @@
context 'with a server with no address' do
before { create(:server) }

it 'returns an empty array' do
it 'returns an empty array' do # rubocop:disable RSpec/ExampleLength
stub_request(:post, 'http://example.com:3000/api/search')
.with(
body: '{"data":"data","algorithm":"algorithm"}',
Expand All @@ -59,17 +58,24 @@
end

context 'with a server with an address' do
# let(:body) { pages.to_json }
let(:body) { { data: '', algorithm: '' }.to_json }
let(:body) { pages.to_json }

before do
create(:server_address)
create(:scheme, :http)
end

it 'returns an array' do
stub_request(:get, 'http://example.com:3000/api/search?q=term')
.with(headers: { 'User-Agent' => 'ELDAC/1.0 (https://eldac.io)' })
it 'returns an array' do # rubocop:disable RSpec/ExampleLength
stub_request(:post, 'http://example.com:3000/api/search')
.with(
body: '{"data":"data","algorithm":"algorithm"}',
headers: {
'Accept' => '*/*',
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Content-Type' => 'application/json',
'User-Agent' => 'user_agent'
}
)
.to_return(status: 200, body:, headers: {})

expect(result.first.title).to eq('title')
Expand All @@ -81,7 +87,7 @@
create(:scheme)
end

it 'returns an array' do
it 'returns an array' do # rubocop:disable RSpec/ExampleLength
stub_request(:post, 'http://example.com:3000/api/search')
.with(
# body: '{"data":"data","algorithm":"algorithm"}',
Expand Down

0 comments on commit d671ca0

Please sign in to comment.