Drop render prefix from social_share_buttons function
This commit is contained in:
parent
4d4b79800a
commit
e1a1bebd95
3 changed files with 10 additions and 10 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
}) %>
|
||||
|
||||
<div id="comments" class="comments mb-3 overflow-hidden">
|
||||
<div class="row border-bottom border-secondary-subtle">
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue