Skip to content
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# main [(unreleased)](https://github.com/fastruby/next_rails/compare/v1.5.0...main)

- [BUGFIX: Fix Ruby 2.3 compatibility in DeprecationTracker#normalized_deprecation_messages](https://github.com/fastruby/next_rails/pull/180)
- [BUGFIX: example](https://github.com/fastruby/next_rails/pull/<number>)

- [BUGFIX: Compare mode now checks only buckets the current process ran, fixing parallel test support](https://github.com/fastruby/next_rails/pull/179)
Expand Down
4 changes: 2 additions & 2 deletions lib/deprecation_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def compare

changed_buckets = []

normalized_deprecation_messages.each do |bucket, messages|
deprecation_messages.each do |bucket, messages|
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuanVqz Why is this necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etagwerker @arielj is not needed but is nice to have, using the deprecation_messages saves the compare process to run the processes made inside of normalized_deprecation_messages.

if stored[bucket] != messages
changed_buckets << bucket
end
Expand Down Expand Up @@ -252,7 +252,7 @@ def normalized_deprecation_messages

# not using `to_h` here to support older ruby versions
{}.tap do |h|
normalized.reject {|_key, value| value.empty? }.sort_by {|key, _value| key }.each do |k ,v|
normalized.reject {|_key, value| value.empty? }.sort_by {|key, _value| key }.each do |k, v|
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL: This comma was getting Ruby 2.3 to fail ♦️

h[k] = v
end
end
Expand Down
54 changes: 54 additions & 0 deletions spec/deprecation_tracker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,60 @@
end
end

describe "#normalized_deprecation_messages" do
Copy link
Copy Markdown
Member Author

@JuanVqz JuanVqz Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding some tests to exercise the normalized_deprecation_messages method against old rubies

it "merges stored and current messages" do
setup_tracker = DeprecationTracker.new(shitlist_path)
setup_tracker.bucket = "bucket 1"
setup_tracker.add("a")
setup_tracker.save

subject = DeprecationTracker.new(shitlist_path)
subject.bucket = "bucket 2"
subject.add("b")

normalized = subject.normalized_deprecation_messages
expect(normalized).to eq(
"bucket 1" => ["a"],
"bucket 2" => ["b"]
)
end

it "sorts messages per bucket" do
subject = DeprecationTracker.new(shitlist_path)
subject.bucket = "bucket 1"
subject.add("c")
subject.add("a")
subject.add("b")

normalized = subject.normalized_deprecation_messages
expect(normalized["bucket 1"]).to eq(["a", "b", "c"])
end

it "rejects empty buckets" do
setup_tracker = DeprecationTracker.new(shitlist_path)
setup_tracker.bucket = "bucket 1"
setup_tracker.add("a")
setup_tracker.save

subject = DeprecationTracker.new(shitlist_path)
# Don't add anything, just read

normalized = subject.normalized_deprecation_messages
expect(normalized).to eq("bucket 1" => ["a"])
end

it "sorts by bucket name" do
subject = DeprecationTracker.new(shitlist_path)
subject.bucket = "z_bucket"
subject.add("a")
subject.bucket = "a_bucket"
subject.add("b")

normalized = subject.normalized_deprecation_messages
expect(normalized.keys).to eq(["a_bucket", "z_bucket"])
end
end

describe "#after_run" do
let(:shitlist_path) { "some_path" }

Expand Down
Loading