aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/test
diff options
context:
space:
mode:
Diffstat (limited to 'actiontext/test')
-rw-r--r--actiontext/test/dummy/config/initializers/backtrace_silencers.rb2
-rw-r--r--actiontext/test/unit/attachment_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/actiontext/test/dummy/config/initializers/backtrace_silencers.rb b/actiontext/test/dummy/config/initializers/backtrace_silencers.rb
index 59385cdf37..3c56b21b3c 100644
--- a/actiontext/test/dummy/config/initializers/backtrace_silencers.rb
+++ b/actiontext/test/dummy/config/initializers/backtrace_silencers.rb
@@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
-# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
diff --git a/actiontext/test/unit/attachment_test.rb b/actiontext/test/unit/attachment_test.rb
index 026078dcec..54831a0271 100644
--- a/actiontext/test/unit/attachment_test.rb
+++ b/actiontext/test/unit/attachment_test.rb
@@ -50,6 +50,11 @@ class ActionText::AttachmentTest < ActiveSupport::TestCase
assert_not_nil trix_attachment.attributes["content"]
end
+ test "converts to plain text" do
+ assert_equal "[Vroom vroom]", ActionText::Attachment.from_attachable(attachable, caption: "Vroom vroom").to_plain_text
+ assert_equal "[racecar.jpg]", ActionText::Attachment.from_attachable(attachable).to_plain_text
+ end
+
test "defaults trix partial to model partial" do
attachable = Page.create! title: "Homepage"
assert_equal "pages/page", attachable.to_trix_content_attachment_partial_path