Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRCH-4972: Update Ruby to version 3.3.0 #247

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ workflows:
matrix:
parameters:
ruby_version:
- 3.0.5
- 3.0.6
- 3.3.0
# not yet compatible with 3.1 or 3.2
elasticsearch_version:
- 7.17.7
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION=3.0.6
ARG RUBY_VERSION=3.3.0
FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-slim as base

WORKDIR /rails
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0.6
FROM ruby:3.3.0
WORKDIR /usr/src/app
EXPOSE 3300

Expand Down
1 change: 1 addition & 0 deletions app/queries/terms_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def query_body
builder = Jbuilder.new do |json|
filtered_query(json)
end

builder.attributes!
end

Expand Down
6 changes: 3 additions & 3 deletions app/workers/mrss_photos_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def get_photos
end

def store_photos(mrss_entries)
mrss_entries.collect do |mrss_entry|
mrss_entries.filter_map do |mrss_entry|
store_photo(mrss_entry)
end.compact.select(&:persisted?)
end.select(&:persisted?)
end

def store_photo(mrss_entry)
Expand All @@ -59,7 +59,7 @@ def store_photo(mrss_entry)

def get_attributes(mrss_entry)
{ id: mrss_entry.entry_id, mrss_names: [@mrss.name], title: mrss_entry.title, description: mrss_entry.summary,
taken_at: mrss_entry.published, url: mrss_entry.url, thumbnail_url: mrss_entry.thumbnail_url }
taken_at: mrss_entry.pub_date || mrss_entry.published, url: mrss_entry.url, thumbnail_url: mrss_entry.thumbnail_url }
end

def fetch_xml(url)
Expand Down
1 change: 0 additions & 1 deletion lib/feedjira/parser/oasis/mrss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Mrss
element :title
element :link
element :description

elements :item, as: :entries, class: Oasis::MrssEntry

attr_accessor :feed_url
Expand Down
17 changes: 6 additions & 11 deletions lib/feedjira/parser/oasis/mrss_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@ class MrssEntry

element :guid, as: :entry_id
element :'dc:identifier', as: :entry_id

element :title

element :link, as: :url

element :pubDate, as: :published
element :pubdate, as: :published
element :'dc:date', as: :published
element :'dc:Date', as: :published
element :'dcterms:created', as: :published
element :issued, as: :published

element :pubDate, as: :pub_date
element :pubdate, as: :pub_date
element :'dc:date', as: :pub_date
element :'dc:Date', as: :pub_date
element :'dcterms:created', as: :pub_date
element :issued, as: :pub_date
element 'media:thumbnail', value: :url, as: :thumbnail_url

element :description, as: :summary
element 'media:description', as: :summary
element 'content:encoded', as: :summary
Expand Down
2 changes: 1 addition & 1 deletion spec/parsers/mrss_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
end

it 'has the correct published time' do
expect(entry.published).to eq(Time.parse('2014-10-22 14:24:00Z'))
expect(entry.pub_date.to_time).to eq(Time.parse('2014-10-22 14:24:00Z'))
end
end
end
Expand Down
10 changes: 4 additions & 6 deletions spec/workers/mrss_photos_importer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
end

it 'indexes the photos' do
expect { perform }.to change{ MrssPhoto.count }.from(0).to(4)
expect { perform }.to change { MrssPhoto.count }.from(0).to(4)
end
end

context 'when MRSS photo entries are returned' do
it 'indexes the photos' do
expect { perform }.to change{ MrssPhoto.count }.from(0).to(4)
expect { perform }.to change { MrssPhoto.count }.from(0).to(4)
end

it 'indexes the expected content' do
Expand Down Expand Up @@ -89,7 +89,7 @@
[photo1, photo2]
end

let(:feed) { double(Feedjira::Parser::Oasis::Mrss, entries: photos) }
let(:feed) { instance_double(Feedjira::Parser::Oasis::Mrss, entries: photos) }

before do
allow(Feedjira::Feed).to receive(:parse).with(mrss_xml) { feed }
Expand Down Expand Up @@ -141,9 +141,7 @@
expect(already_exists.title).to eq('initial title')
expect(already_exists.description).to eq('initial description')
expect(already_exists.tags).to match_array(%w[tag1 tag2])
expect(already_exists.mrss_names).to match_array(
['existing_mrss_name', mrss_profile.name]
)
expect(already_exists.mrss_names).to match_array(['existing_mrss_name', mrss_profile.name])
end
end

Expand Down