blob: 9f2d04f8672b4ae4e09854c8028cd304a8584ac3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
require 'test_helper'
class AssetLicenseTest < ActiveSupport::TestCase
test "find returns a populated entry for a known key" do
entry = AssetLicense.find("cc_by_4")
assert_equal "cc_by_4", entry.key
assert_equal "https://creativecommons.org/licenses/by/4.0/", entry.url
assert entry.requires_attribution
assert_equal "license", entry.style
end
test "find returns nil for an unknown or blank key" do
assert_nil AssetLicense.find("not_a_real_license")
assert_nil AssetLicense.find(nil)
assert_nil AssetLicense.find("")
end
test "keys includes every dictionary entry" do
assert_includes AssetLicense.keys, "cc0"
assert_includes AssetLicense.keys, "own_work"
end
test "a note-style entry has no attribution requirement and no url" do
entry = AssetLicense.find("own_work")
assert_not entry.requires_attribution
assert_nil entry.url
assert_equal "note", entry.style
end
end
|