diff --git a/lib/active_fedora/attribute_methods.rb b/lib/active_fedora/attribute_methods.rb index 979763ba1..2ff4625b9 100644 --- a/lib/active_fedora/attribute_methods.rb +++ b/lib/active_fedora/attribute_methods.rb @@ -177,7 +177,7 @@ def attribute_for_inspect(attr_name) if value.is_a?(String) && value.length > 50 "#{value[0, 50]}...".inspect elsif value.is_a?(Date) || value.is_a?(Time) - %("#{value.to_s(:db)}") + %("#{value.to_formatted_s(:db)}") elsif value.is_a?(Array) && value.size > 10 inspected = value.first(10).inspect %(#{inspected[0...-1]}, ...]) diff --git a/spec/unit/attributes_spec.rb b/spec/unit/attributes_spec.rb index bb2c7277b..b1483fb71 100644 --- a/spec/unit/attributes_spec.rb +++ b/spec/unit/attributes_spec.rb @@ -8,6 +8,7 @@ class BarHistory4 < ActiveFedora::Base index.as :symbol end property :abstract, predicate: ::RDF::Vocab::DC.abstract, multiple: false + property :date, predicate: ::RDF::Vocab::DC.date, multiple: false end end @@ -16,25 +17,25 @@ class BarHistory4 < ActiveFedora::Base end subject(:history) { obj } - let(:obj) { BarHistory4.new(title: ['test1'], id: 'test:123') } + let(:obj) { BarHistory4.new(title: ['test1'], id: 'test:123', date: Date.new(2024, 1, 1)) } describe "#attribute_names" do context "on an instance" do it "lists the attributes" do - expect(history.attribute_names).to eq ["title", "abstract"] + expect(history.attribute_names).to eq ["title", "abstract", "date"] end end context "on a class" do it "lists the attributes" do - expect(BarHistory4.attribute_names).to eq ["title", "abstract"] + expect(BarHistory4.attribute_names).to eq ["title", "abstract", "date"] end end end describe "#inspect" do it "shows the attributes" do - expect(history.inspect).to eq "#" + expect(history.inspect).to eq "#" end describe "with no attributes" do @@ -60,7 +61,7 @@ class BarHistory2 < BarHistory4 end it "shows the library_id" do - expect(history.inspect).to eq "#" + expect(history.inspect).to eq "#" end end end