]> git.openstreetmap.org Git - rails.git/commitdiff
Drop render prefix from social_share_buttons function
authorTom Hughes <tom@compton.nu>
Wed, 18 Dec 2024 16:42:56 +0000 (16:42 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 19 Dec 2024 08:16:57 +0000 (08:16 +0000)
app/helpers/social_share_button_helper.rb
app/views/diary_entries/show.html.erb
test/helpers/social_share_button_helper_test.rb

index edbd056a2e82521b48e1305f7ef80bf013a9d2cc..2980e2ddafd14d8e185345bd8454c93dab2b7069 100644 (file)
@@ -12,7 +12,7 @@ module SocialShareButtonHelper
   }.freeze
 
   # Generates a set of social share buttons based on the specified options.
-  def render_social_share_buttons(opts = {})
+  def social_share_buttons(opts = {})
     sites = opts.fetch(:allow_sites, [])
     valid_sites, invalid_sites = filter_allowed_sites(sites)
 
index 14b1576f0fdc9f6339f169fedddef1622e3bc44b..f54ae1ca7e043afd8d114034625e3c669071dfb4 100644 (file)
 <% end %>
 
 <%= render @entry %>
-<%= render_social_share_buttons({
-                                  :title => @entry.title,
-                                  :url => diary_entry_url(@entry.user, @entry)
-                                }) %>
+<%= social_share_buttons({
+                           :title => @entry.title,
+                           :url => diary_entry_url(@entry.user, @entry)
+                         }) %>
 
 <div id="comments" class="comments mb-3 overflow-hidden">
   <div class="row border-bottom border-secondary-subtle">
index 397cbd11235db2878657874e50656d4f2e02878c..970e154455dae0891402864a5a3c1e17ee10f1b4 100644 (file)
@@ -13,8 +13,8 @@ class SocialShareButtonHelperTest < ActionView::TestCase
     }
   end
 
-  def test_render_social_share_buttons_with_valid_sites
-    result = render_social_share_buttons(@options)
+  def test_social_share_buttons_with_valid_sites
+    result = social_share_buttons(@options)
     assert_includes result, "x"
     assert_includes result, "facebook"
     assert_includes result, "linkedin"
@@ -22,13 +22,13 @@ class SocialShareButtonHelperTest < ActionView::TestCase
 
   def test_render_social_share_buttons_with_invalid_site
     @options[:allow_sites] << "invalid_site"
-    result = render_social_share_buttons(@options)
+    result = social_share_buttons(@options)
     assert_not_includes result, "invalid_site"
   end
 
-  def test_render_social_share_buttons_with_no_sites
+  def test_social_share_buttons_with_no_sites
     @options[:allow_sites] = []
-    result = render_social_share_buttons(@options)
+    result = social_share_buttons(@options)
     SocialShareButtonHelper::SOCIAL_SHARE_CONFIG.each_key do |site|
       assert_includes result, site.to_s # Convert symbol to string
     end