Sha256: 552401c98987edf406a95adf0df9b44a66ce2e24a270c9e055680a281408b249
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require "spec_helper_lite" describe Undo::Serializer::ActiveModel do subject { described_class } let(:serializer) { subject.new } let(:object) { double :object } let(:am_serializer_method) { :as_json } describe "custom serializer" do it "uses provided serializer" do custom_serializer = double :custom_serializer serializer = subject.new custom_serializer expect(custom_serializer).to receive am_serializer_method serializer.serialize object end it "uses custom serializer source" do custom_serializer_source = double :custom_serializer_source custom_serializer = double :custom_serializer serializer = subject.new serializer: custom_serializer_source expect(custom_serializer_source).to receive(:call).with(object) { custom_serializer } expect(custom_serializer).to receive am_serializer_method serializer.serialize object end it "has lower priority than providing the serializer directly" do custom_serializer_source = double :custom_serializer_source custom_serializer = double :custom_serializer serializer = subject.new custom_serializer, serializer: custom_serializer_source expect(custom_serializer_source).not_to receive(:call) expect(custom_serializer).to receive am_serializer_method serializer.serialize object end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
undo-serializer-active_model-0.0.3 | spec/undo/serializer/active_model_spec.rb |