Skip to content

Commit

Permalink
Trying to satisfy Travis, angry god of testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
kueda committed Feb 2, 2016
1 parent 55e71a0 commit b1650d5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
20 changes: 10 additions & 10 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,12 @@ def rights_for_observation( record, options = {} )
user_name = record.user.name
user_name = record.user.login if user_name.blank?
s = if record.license == Observation::CC0
t(:by_user, user: user_name)
I18n.t(:by_user, user: user_name)
else
"© #{user_name}"
end
if record.license.blank?
s += "#{options[:separator]}#{t(:all_rights_reserved)}"
s += "#{options[:separator]}#{I18n.t(:all_rights_reserved)}"
else
s += options[:separator]
s += content_tag(:span) do
Expand All @@ -847,9 +847,9 @@ def rights_for_observation( record, options = {} )
link_to(image_tag("#{record.license}_small.png"), url_for_license(record.license)) + " "
end
if record.license == Observation::CC0
c + link_to(t('copyright.no_rights_reserved'), url_for_license(record.license))
c + link_to(I18n.t('copyright.no_rights_reserved'), url_for_license(record.license))
else
c + link_to(t(:some_rights_reserved), url_for_license(record.license))
c + link_to(I18n.t(:some_rights_reserved), url_for_license(record.license))
end
end
end
Expand All @@ -861,17 +861,17 @@ def rights_for_media( record, options = {} )
user_name = record.native_username if user_name.blank?
user_name = record.user.try(:name) if user_name.blank?
user_name = record.user.try(:login) if user_name.blank?
user_name = t(:unknown) if user_name.blank?
user_name = I18n.t(:unknown) if user_name.blank?
s = if record.copyrighted?
"© #{user_name}"
elsif record.license_code == Observation::CC0
t(:by_user, user: user_name)
I18n.t(:by_user, user: user_name)
else
t('copyright.no_known_copyright_restrictions', name: user_name, license_name: t(:public_domain))
I18n.t('copyright.no_known_copyright_restrictions', name: user_name, license_name: I18n.t(:public_domain))
end

if record.all_rights_reserved?
s += "#{options[:separator]}#{t(:all_rights_reserved)}"
s += "#{options[:separator]}#{I18n.t(:all_rights_reserved)}"
elsif record.creative_commons?
s += options[:separator]
code = Photo.license_code_for_number(record.license)
Expand All @@ -883,9 +883,9 @@ def rights_for_media( record, options = {} )
link_to(image_tag("#{code}_small.png"), url) + " "
end
license_blurb = if record.license_code == Observation::CC0
t("copyright.no_rights_reserved")
I18n.t("copyright.no_rights_reserved")
else
t(:some_rights_reserved)
I18n.t(:some_rights_reserved)
end
c.html_safe + link_to(license_blurb, url)
end
Expand Down
9 changes: 9 additions & 0 deletions spec/models/photo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,13 @@
end
end

describe "attribution_name" do
it "should not be blank even if the user's name is a blank string" do
u = User.make!( name: "" )
p = make_local_photo( user: u )
expect( u.name ).to eq ""
expect( p.attribution_name ).to eq u.login
end
end

end
2 changes: 1 addition & 1 deletion tools/dwca.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
rails runner tools/dwca.rb \
-f public/taxa/CC-BY.dwca.zip \
--license CC-BY
--license CC-BY \
--licenses CC-BY
will output observation records that have the CC BY license, and will license
Expand Down

0 comments on commit b1650d5

Please sign in to comment.