Conversation
This ensures that different Set objects with Thrift objects having the same value are considered equal.
There was a problem hiding this comment.
It looks like struct_fields should be deterministic based on this class_eval method signature, so that's good!
While we're at it, WDYT about adding other equality tests like us1 == us1, [us1] == [us2], { us1 => true } == { us2 => true }?
spec/sparsam_spec.rb
Outdated
| it "respects equality of Sets" do | ||
| us1 = US.new | ||
| us2 = US.new | ||
| expect(Set[us1]).to eq(Set[us2]) |
There was a problem hiding this comment.
Looks like sparsam is not updated to use expect rspec syntax
| expect(Set[us1]).to eq(Set[us2]) | |
| Set[us1].should == Set[us2] |
would hopefully fix the assertion
spec/sparsam_spec.rb
Outdated
| subdata.id_s.should == "id_s default" | ||
| end | ||
|
|
||
| it "respects equality of Sets" do |
There was a problem hiding this comment.
Don't know too much about the way sparsam's tests are structured, but it seems strange to nest this within describe Sparsam::Serializer block
|
@pariser Thanks for the feedback! I implemented it and the tests are passing now. PTAL |
|
To run tests, run |
|
Hi @marionzualo , are you still working on this PR? I also encountered the same problem, two sets are not equal due to the |
|
|
||
| def hash | ||
| struct_fields.map do |fid, data| | ||
| data.hash |
There was a problem hiding this comment.
I think you need to use send(name_to_accessors(data[:name]).reader).hash
This ensures that different Set objects with Thrift objects having the same value are considered equal.
I added a spec but I wasn't able to run it in my local environment.
I get the following error
@pariser