-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add optimistic_lock_token to valkyrie resources on query #475
Conversation
context "without locking enabled" do | ||
before do | ||
class CustomNonlockingResource < Valkyrie::Resource | ||
enable_optimistic_locking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought locking wasn't supposed to be enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's bad!
resource = persister.save(resource: CustomNonlockingResource.new(title: "My Title")) | ||
resource = query_service.find_by(id: resource.id) | ||
query_doc = (query_service.connection.get 'select', :params => {:q => "id:#{resource.id}"})["response"]["docs"].first | ||
expect(resource.optimistic_lock_token.first).to eq query_doc["_version_"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be checking to make sure this isn't set right? Or even that the property doesn't exist I guess.
resource = persister.save(resource: CustomNonlockingResource.new(title: "My Title")) | ||
resource = query_service.find_by(id: resource.id) | ||
query_doc = (query_service.connection.get 'select', params: { q: "id:#{resource.id}" })["response"]["docs"].first | ||
expect(resource.optimistic_lock_token.first).to eq query_doc["_version_"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this not exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it looks like this is actually covered by the resource spec in https://github.com/samvera-labs/valkyrie/pull/474/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we'll just remove that test here.
connected to #286 connected to #453 Co-authored-by: Adam Wead <[email protected]> Co-authored-by: Michael Tribone <[email protected]>
We'll deal with the fact that these aren't coming through from the persister in a forthcoming (persister-focused) PR
connected to #286
connected to #453