mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Clarify interaction between serializer_test and model_test
This business with changing Fluxor on the fly is pretty confusing. It would probably be better to have different models, rather than changing Fluxor's PT config on the fly.
This commit is contained in:
parent
a7620d5062
commit
4d9fc6aaab
3 changed files with 12 additions and 29 deletions
|
@ -1,17 +0,0 @@
|
|||
require "rails_helper"
|
||||
|
||||
describe Fluxor, type: :model do
|
||||
describe "`be_versioned` matcher" do
|
||||
it { is_expected.to_not be_versioned }
|
||||
end
|
||||
|
||||
describe "Methods" do
|
||||
describe "Class" do
|
||||
describe ".paper_trail.enabled?" do
|
||||
it "returns false" do
|
||||
expect(Fluxor.paper_trail.enabled?).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,7 @@
|
|||
class Fluxor < ActiveRecord::Base
|
||||
belongs_to :widget
|
||||
|
||||
# In test/unit/model_test.rb and test/unit/serializer_test.rb, this is
|
||||
# changed on the fly, which is quite confusing.
|
||||
has_paper_trail
|
||||
end
|
||||
|
|
|
@ -2,12 +2,16 @@ require "test_helper"
|
|||
require "custom_json_serializer"
|
||||
|
||||
class SerializerTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
# Clean up after test/unit/model_test.rb
|
||||
Fluxor.reset_callbacks :create
|
||||
Fluxor.reset_callbacks :update
|
||||
Fluxor.reset_callbacks :destroy
|
||||
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
|
||||
|
@ -34,10 +38,6 @@ class SerializerTest < ActiveSupport::TestCase
|
|||
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
|
||||
|
@ -77,10 +77,6 @@ class SerializerTest < ActiveSupport::TestCase
|
|||
config.serializer = CustomJsonSerializer
|
||||
end
|
||||
|
||||
Fluxor.instance_eval <<-END
|
||||
has_paper_trail
|
||||
END
|
||||
|
||||
@fluxor = Fluxor.create
|
||||
|
||||
# this is exactly what PaperTrail serializes
|
||||
|
|
Loading…
Reference in a new issue