summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/controllers/nodes_controller_test.rb2
-rw-r--r--test/models/node_test.rb17
-rw-r--r--test/models/related_asset_test.rb2
3 files changed, 19 insertions, 2 deletions
diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb
index d7a3abbd..0b6e65ee 100644
--- a/test/controllers/nodes_controller_test.rb
+++ b/test/controllers/nodes_controller_test.rb
@@ -628,7 +628,7 @@ class NodesControllerTest < ActionController::TestCase
628 test "chapters renders the curated heading" do 628 test "chapters renders the curated heading" do
629 login_as :quentin 629 login_as :quentin
630 get :chapters 630 get :chapters
631 assert_select "h1", "Chapters" 631 assert_select "h1", "Dezentrale"
632 end 632 end
633 633
634 test "sitemap collapses configured paths but leaves others open" do 634 test "sitemap collapses configured paths but leaves others open" do
diff --git a/test/models/node_test.rb b/test/models/node_test.rb
index c5b0d6a2..c1316ea6 100644
--- a/test/models/node_test.rb
+++ b/test/models/node_test.rb
@@ -919,4 +919,21 @@ class NodeTest < ActiveSupport::TestCase
919 node.reload 919 node.reload
920 assert_raises(ActiveRecord::RecordInvalid) { node.publish_draft! } 920 assert_raises(ActiveRecord::RecordInvalid) { node.publish_draft! }
921 end 921 end
922
923 test "refusals localise their message rather than hardcoding it" do
924 trash = Node.trash
925
926 I18n.with_locale(:de) do
927 error = assert_raises(ActiveRecord::RecordInvalid) { trash.trash! }
928 assert_includes error.message,
929 I18n.t("activerecord.errors.models.node.attributes.base.trash_the_trash")
930 end
931
932 I18n.with_locale(:en) do
933 trash.errors.clear
934 error = assert_raises(ActiveRecord::RecordInvalid) { trash.trash! }
935 assert_includes error.message,
936 I18n.t("activerecord.errors.models.node.attributes.base.trash_the_trash")
937 end
938 end
922end 939end
diff --git a/test/models/related_asset_test.rb b/test/models/related_asset_test.rb
index bb86ddbb..ea7c3d35 100644
--- a/test/models/related_asset_test.rb
+++ b/test/models/related_asset_test.rb
@@ -29,7 +29,7 @@ class RelatedAssetTest < ActiveSupport::TestCase
29 29
30 related.headline = true 30 related.headline = true
31 assert_not related.valid? 31 assert_not related.valid?
32 assert_includes related.errors[:headline], "can only be set on image or PDF assets" 32 assert_includes related.errors[:headline], I18n.t("activerecord.errors.models.related_asset.attributes.headline.images_and_pdfs_only")
33 end 33 end
34 34
35 test "the headline validation does not raise when asset is missing" do 35 test "the headline validation does not raise when asset is missing" do