spec/audited/audit_spec.rb in audited-4.9.0 vs spec/audited/audit_spec.rb in audited-4.10.0
- old
+ new
@@ -1,8 +1,8 @@
require "spec_helper"
-SingleCov.covered!
+SingleCov.covered! uncovered: 1 # Rails version check
describe Audited::Audit do
let(:user) { Models::ActiveRecord::User.new name: "Testing" }
describe "audit class" do
@@ -60,11 +60,11 @@
audit.audited_changes = {foo: "bar"}
expect(audit.audited_changes).to eq foo: "bar"
end
it "does not unserialize from binary columns" do
- allow(Audited.audit_class.columns_hash["audited_changes"]).to receive(:type).and_return("foo")
+ allow(Audited::YAMLIfTextColumnType).to receive(:text_column?).and_return(false)
audit.audited_changes = {foo: "bar"}
expect(audit.audited_changes).to eq "{:foo=>\"bar\"}"
end
end
@@ -172,10 +172,10 @@
describe ".collection_cache_key" do
if ActiveRecord::VERSION::MAJOR >= 5
it "uses created at" do
Audited::Audit.delete_all
audit = Models::ActiveRecord::User.create(name: "John").audits.last
- audit.update_columns(created_at: Time.parse('2018-01-01'))
+ audit.update_columns(created_at: Time.zone.parse('2018-01-01'))
expect(Audited::Audit.collection_cache_key).to match(/-20180101\d+$/)
end
else
it "is not defined" do
expect { Audited::Audit.collection_cache_key }.to raise_error(NoMethodError)