Commit Graph

30 Commits

Author SHA1 Message Date
Jared Beck e9072950b2 Add optional column: item_subtype
If present, will be populated with subclass name. This will be
used by PT-AT.
2018-08-22 00:42:37 -04:00
Jared Beck 9f004a60e0 Revert #1108 (lorint's STI fix)
This partially reverts commit 58369e1d8f.
I have kept the specs, skipped.

Per the following, this approach does not seem to be working:

- https://github.com/paper-trail-gem/paper_trail/issues/1135
- https://github.com/paper-trail-gem/paper_trail/pull/1137
- https://github.com/seanlinsley/paper_trail/pull/1
2018-08-21 23:13:34 -04:00
Jared Beck ed4a39141b Do not require PT-AT
[Fixes #1134]
2018-08-14 18:56:46 -04:00
Jared Beck ec2e693907 Remove unnecessary deprecation silencer 2018-08-14 01:49:09 -04:00
Jared Beck dadba10f18 Avoid changing schema during test run
Sean's approach to dropping/re-adding the column during the test run
worked, but it had a few disadvantages:

1. it required a `before(:all)` callback, which is frowned upon by rubocop-rspec
2. more importantly, it could have prevented us from using test parallelization
  in the future
3. least importantly, it produced annoying output in the middle of the test run
2018-08-13 15:51:02 -04:00
Sean Linsley f3eb770297 remove `save_changes` setting 2018-08-12 19:33:10 -05:00
lorint 58369e1d8f Fix for issue #594, reifying sub-classed models that use STI (#1108)
See the changes to the changelog and readme for details.
2018-07-30 10:50:32 -04:00
Jared Beck ffdb9df3b3 Various improvements to json_version_spec 2018-06-10 13:15:59 -04:00
Jared Beck 72d4361a3b Tests: Fix deprecation: represent_boolean_as_integer 2018-06-07 14:43:56 -04:00
Jared Beck 3d4b44d422 Tests: Fix deprecation warning re: secret_key_base 2018-06-07 14:43:56 -04:00
Jared Beck f3bc5290ee Automate test setup
Goal: rake default task can do everything without manual setup

Also delete `spec/dummy_app/db/schema.rb`. People forget (understandably)
to update it. As long as we don't use the db:setup task first,
we don't need it.
2018-06-04 00:32:47 -04:00
Weston Ganger d056c7e13b Add PaperTrail.config.association_reify_error_behaviour (#1091)
* add PaperTrail.config.association_reify_error_behaviour

* fix test for Rails 4.2

* PaperTrail.config.association_reify_error_behaviour test in isolation, fixes

* association_error_behaviour fix specs

* fix rubocop errors

* assoication_reify_error_behaviour fixes
2018-05-23 01:37:48 -04:00
Anton Rieder 8f8f5587e9
Change URLs to paper-trail-gem 2018-05-09 13:25:56 +02:00
Jared Beck e05eef6ae7 Lint: Style/LineEndConcatenation
I've come around to where I don't mind the backslash.
2018-03-27 18:35:00 -04:00
Jared Beck c0633be405 Lint: Style/ExpandPathArguments 2018-03-27 18:32:52 -04:00
Jared Beck 025ceef943 Ask for help with association tracking 2018-03-24 00:26:28 -04:00
Jared Beck 2a169ae17d Follow-up work re: touch 2018-03-16 19:06:17 -04:00
Jared Beck c659b1faf0 A new API for request variables 2018-02-27 00:14:33 -05:00
Jared Beck c5b4a9ec66 Raise helpful error when CVC is abstract
Instead of crashing when misconfigured Custom Version Classes are
used, an error will be raised earlier, with a much more helpful message.

[Fixes #961]
2018-01-22 00:23:51 -05:00
André Hester 9b2f2c1c2c Remove unused vehicle association from person model 2017-12-21 23:35:17 +01:00
André Hester dd80ccf240 Use base class name for reification instead of class name to reify polymorphic models properly 2017-12-21 23:17:12 +01:00
André Hester b833f8d19d Add explicit precision on datetime columns to enable fractional second precision on mysql 2017-12-21 23:11:32 +01:00
Jared Beck cfbf7a647c Lint: Style/FrozenStringLiteralComment 2017-12-10 23:05:39 -05:00
Hubert Pompecki 4cce9b0179 Serializing postgres arrays (#1018)
This PR addresses #1015

Starting from Rails version 5.0.2 the default serializer of PostgreSQL columns returns an ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array object instead of a string. This new object is not suitable for JSON encoding and breaks versioning of any array fields backed by Postgres.

Whenever a PostgreSQL array is used, instead of asking Active Record for a serializer we introduce our own, which simply returns the underlying array without any modifications.
2017-12-08 11:44:40 -05:00
Jared Beck 08b25608bd Fix StatementInvalid error in schema.rb
```
ActiveRecord::StatementInvalid: SQLite3::SQLException:
object name reserved for internal use:
sqlite_autoindex_custom_primary_key_records_1:
CREATE UNIQUE INDEX "sqlite_autoindex_custom_primary_key_records_1"
ON "custom_primary_key_records" ("uuid")
```
2017-10-17 17:58:32 -04:00
chimame 56991ae9a1 Fix item_type in association reification query (#996)
When a record is inserted into the `versions` table, it is given an `item_type` like `Foo::Bar`, but the association reification queries were searching for an `item_type` like `::Foo::Bar`.
2017-10-04 22:02:46 -04:00
Jared Beck 408aa74dc6 Drop support for rails 4.0 and 4.1
EoL for both was 2016-06-30
http://weblog.rubyonrails.org/2016/6/30/Rails-5-0-final/

PT continued to support them for 15 months after EoL.
2017-09-20 05:26:13 -04:00
Joel Hayhurst 29623cfa63 Support belongs_to_required_by_default
Since Rails 5.0, belongs_to_required_by_default has been the official ActiveRecord default.
Add the configuration lines necessary to enable this default in both 5.0 and 5.1.
Add "optional: true" where necessary to fix spec failures caused by this change.
Add version-checking conditionals where necessary.
Update the Changelog appropriately.
2017-08-30 14:02:56 -07:00
Jared Beck 7295f65a3c Organizing model tests
model_spec is far too long, let's break it up into specs for individual
models in the dummy app.

Extract spec/models/legacy_widget_spec.rb

Extract spec/models/on/empty_array_spec.rb

Extract spec/models/on/create_spec.rb

Extract spec/models/on/update_spec.rb

Extract spec/models/on/destroy_spec.rb

Move an example to config_spec.rb

Extract spec/models/translation_spec.rb

Extract spec/models/article_spec.rb

Move examples to document_spec.rb
2017-07-05 00:15:15 -04:00
Jared Beck 94b9306647 Finish the conversion to RSpec
- Convert serializers/mixin_json_test.rb to rspec
- Convert functional/thread_safety_test.rb to rspec
- Convert functional/controller_test.rb to rspec
- Move the dummy app from test to spec, delete test dir
2017-06-10 01:45:46 -04:00