aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinhui2016-11-15 11:50:54 +0100
committerXinhui2016-11-15 11:50:58 +0100
commitb456753eb511aeb33464c52c1780988a9e6d3091 (patch)
treeb7c5fd6b3e53a8c45141a0afb7793ae52dd929f2
parent4acc72a492853c50774275a8435e091f62acc08c (diff)
downloadchouette-core-b456753eb511aeb33464c52c1780988a9e6d3091.tar.bz2
Fix rspec sync message criticity
-rw-r--r--app/helpers/sync_message_helper.rb5
-rw-r--r--app/models/line_referential_sync_message.rb2
-rw-r--r--app/models/stop_area_referential_sync_message.rb2
-rw-r--r--app/views/line_referentials/show.html.slim2
-rw-r--r--app/views/stop_area_referentials/show.html.slim2
5 files changed, 9 insertions, 4 deletions
diff --git a/app/helpers/sync_message_helper.rb b/app/helpers/sync_message_helper.rb
new file mode 100644
index 000000000..d4f11c0f5
--- /dev/null
+++ b/app/helpers/sync_message_helper.rb
@@ -0,0 +1,5 @@
+module SyncMessageHelper
+ def criticity_class criticity
+ return criticity == 'error' ? 'danger' : criticity
+ end
+end
diff --git a/app/models/line_referential_sync_message.rb b/app/models/line_referential_sync_message.rb
index da9db4095..3b6cf3367 100644
--- a/app/models/line_referential_sync_message.rb
+++ b/app/models/line_referential_sync_message.rb
@@ -1,6 +1,6 @@
class LineReferentialSyncMessage < ActiveRecord::Base
belongs_to :line_referential_sync
- enum criticity: [:info, :warning, :danger]
+ enum criticity: [:info, :warning, :error]
validates :criticity, presence: true
end
diff --git a/app/models/stop_area_referential_sync_message.rb b/app/models/stop_area_referential_sync_message.rb
index d75c25ebb..cd2e62405 100644
--- a/app/models/stop_area_referential_sync_message.rb
+++ b/app/models/stop_area_referential_sync_message.rb
@@ -1,6 +1,6 @@
class StopAreaReferentialSyncMessage < ActiveRecord::Base
belongs_to :stop_area_referential_sync
- enum criticity: [:info, :warning, :danger]
+ enum criticity: [:info, :warning, :error]
validates :criticity, presence: true
end
diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim
index 95f097fc8..3e9cab269 100644
--- a/app/views/line_referentials/show.html.slim
+++ b/app/views/line_referentials/show.html.slim
@@ -31,7 +31,7 @@
- unless sync.line_referential_sync_messages.empty?
- sync.line_referential_sync_messages.last.tap do |log|
- if log.criticity = log.criticity
- li.alert class="alert-#{log.criticity}"
+ li.alert class="alert-#{criticity_class(log.criticity)}"
strong = l(log.created_at, format: :short) + " : "
/ [:processing_time] unit conversion
- data = log.message_attributs.symbolize_keys!
diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim
index 907cdb168..9080d1bec 100644
--- a/app/views/stop_area_referentials/show.html.slim
+++ b/app/views/stop_area_referentials/show.html.slim
@@ -19,7 +19,7 @@
- unless sync.stop_area_referential_sync_messages.empty?
- sync.stop_area_referential_sync_messages.last.tap do |log|
- if log.criticity = log.criticity
- li.alert class="alert-#{log.criticity}"
+ li.alert class="alert-#{criticity_class(log.criticity)}"
strong = l(log.created_at, format: :short) + " : "
/ [:processing_time] unit conversion
- data = log.message_attributs.symbolize_keys!