Sha256: fee9b9c38804a47a485b44e6d96e1eb25548b3b29ee71b6a6e2b21da97657921
Contents?: true
Size: 771 Bytes
Versions: 8
Compression:
Stored size: 771 Bytes
Contents
require 'spec_helper' describe Mongoid::History::Tracker do before :all do class Element include Mongoid::Document include Mongoid::Timestamps include Mongoid::History::Trackable field :body track_history on: [:body], track_create: true, track_update: true, track_destroy: true end class Prompt < Element end end it 'tracks subclass create and update' do prompt = Prompt.new expect { prompt.save! }.to change(Tracker, :count).by(1) expect { prompt.update_attributes!(body: 'one') }.to change(Tracker, :count).by(1) prompt.undo! expect(prompt.body).to be_blank prompt.redo! nil, 2 expect(prompt.body).to eq('one') expect { prompt.destroy }.to change(Tracker, :count).by(1) end end
Version data entries
8 entries across 8 versions & 2 rubygems