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
1 change: 0 additions & 1 deletion lib/turbo_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "open3"
require "fileutils"
require "ostruct"
require "json"
Copy link
Collaborator

Choose a reason for hiding this comment

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

json gem is used TurboTests::JsonRowsFormatter#JsonRowsFormatter to provide to_json method, similarly to the RSpec::Core::Formatters::JsonFormatter#close method.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, indeed! Sounds like we still need json then!

require "rspec"

Expand Down
4 changes: 1 addition & 3 deletions lib/utils/hash_extension.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module CoreExtensions
refine Hash do
def to_struct
OpenStruct.new(self.each_with_object({}) do |(key, val), acc|
acc[key] = val.is_a?(Hash) ? val.to_struct : val
end)
Struct.new(*self.keys).new(*self.values.map { |value| value.is_a?(Hash) ? value.to_struct : value })
end
Comment on lines 3 to 5
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if to_struct is even needed. It converts the notification passed to the group_started method. It looks like, RSpec::Core::Notifications::GroupNotification can be used instead.

@smileart Do you remember why RSpec::Core::Notifications::GroupNotification was not used instead in #7?

end
end