Merged
Conversation
Declares a `Module` a `Primitive`. This improves a module's description
to the already nice looking one of a `Class` (see below).
This also affects (considered reasonably):
- `SuperDiff::EqualityMatchers::Primitive.applies_to?`
- `SuperDiff::Core::RecursionGuard.guarding_recursion_of`
A regression of the change would be reported by new examples (which are
a copy of the examples for the class `SuperDiff::Test::Person`) like
this:
```
1) SuperDiff.inspect_object for Ruby objects given a module given as_lines: false returns the module's name
Failure/Error: expect(string).to eq("SuperDiff::Test")
Expected "#<Module:0x0000000107f7a0a0>" to eq "SuperDiff::Test".
# ./lib/super_diff/rspec/monkey_patches.rb:43:in `handle_failure'
# ./spec/unit/super_diff_spec.rb:1135:in `block (5 levels) in <top (required)>'
2) SuperDiff.inspect_object for Ruby objects given a module given as_lines: true returns the module's name as value
Failure/Error:
expect(tiered_lines).to match(
[
an_object_having_attributes(
type: :delete,
indentation_level: 1,
value: "SuperDiff::Test"
)
]
)
Expected [#<SuperDiff::Core::Line:0x0000000112e58a40 @add_comma=false, @children=[], @collection_bookend=nil, @complete_bookend=nil, @elided=false, @indentation_level=1, @Prefix="", @type=:delete, @value="#<Module:0x0000000107f7a0a0>">]
to match [#<an object having attributes (type: :delete, indentation_level: 1, value: "SuperDiff::Test")>]
Diff:
┌ (Key) ──────────────────────────┐
│ ‹-› in expected, not in actual │
│ ‹+› in actual, not in expected │
│ ‹ › in both expected and actual │
└─────────────────────────────────┘
[
#<SuperDiff::Core::Line:0x0000000112e58a40 {
@type=:delete,
@indentation_level=1,
- @value="SuperDiff::Test"
+ @value="#<Module:0x0000000107f7a0a0>"
}>
]
# ./lib/super_diff/rspec/monkey_patches.rb:43:in `handle_failure'
# ./spec/unit/super_diff_spec.rb:1148:in `block (5 levels) in <top (required)>'
```
2330d05 to
71511e6
Compare
Whoa, a github action without any helpful output is weird. And to not have the same tool chain installed locally too. For the records: ``` # node was already installed npm install yarn yarn add lint node_modules/.bin/yarn lint:fix ```
Collaborator
|
Thanks for the PR, @phorsuedzie ! I'll take a look soon. I want to address your setup comments – I think we could improve the linter. I'm considering switching back to Rubocop or another Ruby-based linter to keep things in the same ecosystem. |
jas14
approved these changes
Sep 25, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A module's inspection (used e.g. generate a description of an RSpec example) has been improved to now include the module's name, which identifies the module better than the previous string.
Old:
#<Module:0x0000000107f7a0a0>New (e.g.):
SuperDiff::Test.The improvement declares a
ModuleaPrimitive(which is what has been used for aClassalready).Closes #255.
FYI: Most of the time was spent to get the specs run locally. See 24b8183.