Skip to content

Rspec matcher have_a_version_with_changes fails #4

@raivil

Description

@raivil

The rspec example from paper_trail will fail when using paper_trail-hashdiff.

gem "paper_trail", "~> 14.0.0"
gem "paper_trail-hashdiff", "~> 0.1.3"
describe '`have_a_version_with_changes` matcher' do
  it 'is possible to do assertions on version changes' do
    member.update!(full_name: 'Leonard')
    member.update!(full_name: 'Tom')
    expect(member).to have_a_version_with_changes full_name: 'Leonard'
  end
end

Error:

ActiveRecord::StatementInvalid:
       PG::InvalidTextRepresentation: ERROR:  invalid input syntax for type json
       LINE 1: ...t_changes -> 'full_name')::jsonb ->> 0)::jsonb @> 'Leonard')...

Invalid generated query:

SELECT 1 AS one FROM "versions" WHERE "versions"."item_id" = 131 AND "versions"."item_type" = 'Member' AND ((((object_changes -> 'full_name')::jsonb ->> 0)::jsonb @> 'Leonard')) LIMIT 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions