From: Tom Hughes Date: Wed, 18 Dec 2024 16:42:56 +0000 (+0000) Subject: Drop render prefix from social_share_buttons function X-Git-Tag: live~197^2~4 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e1a1bebd956a3334785ab52d28e27e4e73f63b41?ds=inline;hp=4d4b79800ac2b4ea282a74a9660c11d2748ee5c2 Drop render prefix from social_share_buttons function --- diff --git a/app/helpers/social_share_button_helper.rb b/app/helpers/social_share_button_helper.rb index edbd056a2..2980e2dda 100644 --- a/app/helpers/social_share_button_helper.rb +++ b/app/helpers/social_share_button_helper.rb @@ -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) diff --git a/app/views/diary_entries/show.html.erb b/app/views/diary_entries/show.html.erb index 14b1576f0..f54ae1ca7 100644 --- a/app/views/diary_entries/show.html.erb +++ b/app/views/diary_entries/show.html.erb @@ -15,10 +15,10 @@ <% 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) + }) %>
diff --git a/test/helpers/social_share_button_helper_test.rb b/test/helpers/social_share_button_helper_test.rb index 397cbd112..970e15445 100644 --- a/test/helpers/social_share_button_helper_test.rb +++ b/test/helpers/social_share_button_helper_test.rb @@ -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