From 59cae397d88b3033ef3f1b072e998b796e2211e6 Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Tue, 17 Nov 2015 23:59:35 -0500 Subject: [PATCH 1/2] Fix NameError: uninitialized constant JsonVersion --- spec/models/json_version_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/models/json_version_spec.rb b/spec/models/json_version_spec.rb index ac6b0cfc..694f8771 100644 --- a/spec/models/json_version_spec.rb +++ b/spec/models/json_version_spec.rb @@ -1,6 +1,8 @@ -if JsonVersion.table_exists? +require 'rails_helper' - require 'rails_helper' +# The `json_versions` table tests postgres' `json` data type. So, that +# table is only created when testing against postgres and ActiveRecord >= 4. +if JsonVersion.table_exists? describe JsonVersion, :type => :model do it "should include the `VersionConcern` module to get base functionality" do From 2b26d920764ee8debea60a43f4f66081453549c9 Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Wed, 18 Nov 2015 00:46:00 -0500 Subject: [PATCH 2/2] Fix incorrect decimal comparison delta The column has a precision of 4, so the delta should be 0.0001. See https://github.com/rails/rails/issues/22325 --- test/unit/model_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index e1c27efa..5a03f2e5 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -442,7 +442,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end should 'handle decimals' do - assert_in_delta 2.71828, @previous.a_decimal, 0.00001 + assert_in_delta 2.7183, @previous.a_decimal, 0.0001 end should 'handle datetimes' do @@ -484,7 +484,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal 'The quick brown fox', @last.reify.a_text assert_equal 42, @last.reify.an_integer assert_in_delta 153.01, @last.reify.a_float, 0.001 - assert_in_delta 2.71828, @last.reify.a_decimal, 0.00001 + assert_in_delta 2.7183, @last.reify.a_decimal, 0.0001 assert_equal @date_time.to_time.utc.to_i, @last.reify.a_datetime.to_time.utc.to_i assert_equal @time.utc.to_i, @last.reify.a_time.utc.to_i assert_equal @date, @last.reify.a_date