test/unit/serializer_test.rb in paper_trail-5.2.3 vs test/unit/serializer_test.rb in paper_trail-6.0.0
- old
+ new
@@ -1,15 +1,22 @@
require "test_helper"
require "custom_json_serializer"
class SerializerTest < ActiveSupport::TestCase
+ extend CleanupCallbacks
+
+ cleanup_callbacks(Fluxor, :create)
+ cleanup_callbacks(Fluxor, :update)
+ cleanup_callbacks(Fluxor, :destroy)
+ cleanup_callbacks(Fluxor, :save)
+
+ setup do
+ Fluxor.instance_eval "has_paper_trail"
+ end
+
context "YAML Serializer" do
setup do
- Fluxor.instance_eval <<-END
- has_paper_trail
- END
-
@fluxor = Fluxor.create name: "Some text."
# this is exactly what PaperTrail serializes
@original_fluxor_attributes = @fluxor.paper_trail.attributes_before_change
@@ -32,14 +39,10 @@
setup do
PaperTrail.configure do |config|
config.serializer = PaperTrail::Serializers::JSON
end
- Fluxor.instance_eval <<-END
- has_paper_trail
- END
-
@fluxor = Fluxor.create name: "Some text."
# this is exactly what PaperTrail serializes
@original_fluxor_attributes = @fluxor.paper_trail.attributes_before_change
@@ -74,13 +77,9 @@
context "Custom Serializer" do
setup do
PaperTrail.configure do |config|
config.serializer = CustomJsonSerializer
end
-
- Fluxor.instance_eval <<-END
- has_paper_trail
- END
@fluxor = Fluxor.create
# this is exactly what PaperTrail serializes
@original_fluxor_attributes = @fluxor.