Sha256: d9bf993b381ee9573f0bbb50fc8e9e1cea1c425410742f77d5e7d61729822b6f
Contents?: true
Size: 913 Bytes
Versions: 27
Compression:
Stored size: 913 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 require "spec_helper" describe Mongoid::Timestamps::Created do describe ".included" do let(:quiz) do Quiz.new end let(:fields) do Quiz.fields end before do quiz.run_callbacks(:create) quiz.run_callbacks(:save) end it "adds created_at to the document" do expect(fields["created_at"]).to_not be_nil end it "does not add updated_at to the document" do expect(fields["updated_at"]).to be_nil end it "forces the created_at timestamps to UTC" do expect(quiz.created_at).to be_within(10).of(Time.now.utc) end end context "when the document is created" do let(:quiz) do Quiz.create end it "runs the created callbacks" do expect(quiz.created_at).to_not be_nil expect(quiz.created_at).to be_within(10).of(Time.now.utc) end end end
Version data entries
27 entries across 27 versions & 2 rubygems