module Regressor::Model::Mongoid::Document::Timestamp
Public Instance Methods
timestamp_includes()
click to toggle source
# File lib/model/mongoid/document/timestamp.rb, line 6 def timestamp_includes included_timestamp_modules.map do |module_included| "it { is_expected.to #{timestamp_module(module_included)} }" end.join("\n ") end
Private Instance Methods
included_timestamp_modules()
click to toggle source
# File lib/model/mongoid/document/timestamp.rb, line 14 def included_timestamp_modules @model.included_modules.select do |module_included| ['Mongoid::Timestamps::Created', 'Mongoid::Timestamps::Updated', 'Mongoid::Timestamps'].include? module_included.to_s end end
timestamp_module(module_included)
click to toggle source
# File lib/model/mongoid/document/timestamp.rb, line 20 def timestamp_module(module_included) case module_included.to_s when 'Mongoid::Timestamps' timestamped_document when 'Mongoid::Timestamps::Created' timestamped_document_with_created when 'Mongoid::Timestamps::Updated' timestamped_document_with_updated end end
timestamped_document()
click to toggle source
# File lib/model/mongoid/document/timestamp.rb, line 31 def timestamped_document 'be_timestamped_document' end
timestamped_document_with_created()
click to toggle source
# File lib/model/mongoid/document/timestamp.rb, line 35 def timestamped_document_with_created "#{timestamped_document}.with(:created)" end
timestamped_document_with_updated()
click to toggle source
# File lib/model/mongoid/document/timestamp.rb, line 39 def timestamped_document_with_updated "#{timestamped_document}.with(:updated)" end