Fixed paper trail inconsistent results for numeric values
There is a known issue in paper_trail that whenever we Query the 'versions.object' column it evaluates inconsistent results for numeric values due to limitations of SQL wildcard matchers against the serialized objects. So to fix this issue I have manually formed the where query instead of using where_object and where_object_changes. I have also added test for the same. Fixes #1307
This commit is contained in:
parent
52c90811a6
commit
ad0ea4b7d0
3 changed files with 48 additions and 7 deletions
26
spec/controllers/admin/events_controller_spec.rb
Normal file
26
spec/controllers/admin/events_controller_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::EventsController do
|
||||
let(:conference) { create(:conference) }
|
||||
let(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||
let(:organizer) { create(:user, role_ids: organizer_role.id) }
|
||||
let!(:event_without_commercial) { create(:event, program: conference.program) }
|
||||
let!(:event_with_commercial) { create(:event, program: conference.program) }
|
||||
let!(:event_commercial) { create(:event_commercial, commercialable: event_with_commercial, url: 'https://www.youtube.com/watch?v=M9bq_alk-sw') }
|
||||
|
||||
with_versioning do
|
||||
describe 'GET #show' do
|
||||
before :each do
|
||||
sign_in(organizer)
|
||||
get :show, id: event_without_commercial.id, conference_id: conference.short_title
|
||||
end
|
||||
|
||||
it 'assigns versions' do
|
||||
versions = event_without_commercial.versions
|
||||
expect(event_without_commercial.id).to eq event_commercial.id
|
||||
expect(event_commercial.id).not_to eq event_commercial.commercialable_id
|
||||
expect(assigns(:versions)).to eq versions
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue