Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Attachment#urlname #1911

Merged
merged 1 commit into from
Jul 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/models/alchemy/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ def slug
CGI.escape(file_name.gsub(/\.#{extension}$/, "").tr(".", " "))
end

alias_method :urlname, :slug
deprecate urlname: :slug, deprecator: Alchemy::Deprecation

# Checks if the attachment is restricted, because it is attached on restricted pages only
def restricted?
pages.any? && pages.not_restricted.blank?
Expand Down
8 changes: 4 additions & 4 deletions spec/models/alchemy/attachment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ module Alchemy

context "with extra params given" do
subject do
attachment.url(download: true, name: attachment.urlname, format: attachment.suffix)
attachment.url(download: true, name: attachment.slug, format: attachment.suffix)
end

it "returns local download path with name and suffix" do
is_expected.to eq "/attachment/#{attachment.id}/download/#{attachment.urlname}.#{attachment.suffix}"
is_expected.to eq "/attachment/#{attachment.id}/download/#{attachment.slug}.#{attachment.suffix}"
end
end
end
Expand All @@ -94,11 +94,11 @@ module Alchemy

context "with extra params given" do
subject do
attachment.url(download: false, name: attachment.urlname, format: attachment.suffix)
attachment.url(download: false, name: attachment.slug, format: attachment.suffix)
end

it "returns local path with name and suffix" do
is_expected.to eq "/attachment/#{attachment.id}/show/#{attachment.urlname}.#{attachment.suffix}"
is_expected.to eq "/attachment/#{attachment.id}/show/#{attachment.slug}.#{attachment.suffix}"
end
end
end
Expand Down