The personal finance app for everyone
Fix: i18n symbol typo (#1085)
Pedro Carmona3c64f3ff3b35
diff --git a/app/models/time_series/value.rb b/app/models/time_series/value.rbindex 2f698768..c02dc3e4 100644--- a/app/models/time_series/value.rb+++ b/app/models/time_series/value.rb@@ -41,7 +41,7 @@ class TimeSeries::Valuedef value_must_be_of_known_typeunless value.is_a?(Money) || value.is_a?(Numeric)# i18n-tasks-use t('activemodel.errors.models.time_series/value.attributes.value.must_be_a_money_or_numeric')- errors.add :value, must_be_a_money_or_numeric+ errors.add :value, :must_be_a_money_or_numericendendenddiff --git a/test/models/time_series_test.rb b/test/models/time_series_test.rbindex e2bfc564..a6a8431c 100644--- a/test/models/time_series_test.rb+++ b/test/models/time_series_test.rb@@ -69,4 +69,34 @@ class TimeSeriesTest < ActiveSupport::TestCaseassert_equal expected_values, series.to_jsonend++ test "it does not accept invalid values in Time Series Trend" do+ error = assert_raises(ActiveModel::ValidationError) do+ TimeSeries.new(+ [+ { date: 1.day.ago.to_date, value: 100 },+ { date: Date.current, value: "two hundred" }+ ]+ )+ end+ assert_match(/Current must be of the same type as previous/, error.message)+ assert_match(/Previous must be of the same type as current/, error.message)+ assert_match(/Current must be of type Money, Numeric, or nil/, error.message)+ end+++ test "it does not accept invalid values in Time Series Value" do+ # We need to stub trend otherwise an error is raised before TimeSeries::Value validation+ TimeSeries::Trend.stub(:new, nil) do+ error = assert_raises(ActiveModel::ValidationError) do+ TimeSeries.new(+ [+ { date: 1.day.ago.to_date, value: 100 },+ { date: Date.current, value: "two hundred" }+ ]+ )+ end+ assert_equal "Validation failed: Value must be a Money or Numeric", error.message+ end+ endend