forked from citation-style-language/styles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdependent_styles_spec.rb
88 lines (67 loc) · 2.22 KB
/
dependent_styles_spec.rb
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Dependents.each_pair do |id, (filename, path, style)|
describe "dependent style #{id}" do
it "is a valid CSL 1.0 style" do
CSL.validate(path).should == []
end
it "has a conventional file name" do
filename.should match(/^[a-z\d]+(-[a-z\d]+)*\.csl$/)
end
it "was successfully parsed" do
style.should be_a(CSL::Style)
end
unless style.nil?
it "is dependent" do
style.should be_dependent
end
it "has an info element" do
style.should have_info
end
it "does not have any rendering elements" do
style.should_not have_macro
style.should_not have_citation
style.should_not have_bibliography
end
it "the self-link (if present) is a valid style repository link" do
if style.has_self_link?
style.self_link.should == "http://www.zotero.org/styles/#{id}"
end
end
it "the self-link (if present) matches the style id" do
if style.has_self_link?
style.id.should == style.self_link
end
end
it "does not have a template-link" do
style.should_not have_template_link
end
it "has an id" do
style.should have_id
end
it "the id is a valid style repository link" do
style.id.should == "http://www.zotero.org/styles/#{id}"
end
it "has an info/rights element" do
style.info.should have_rights
end
it "is licensed under a CC BY-SA license" do
style.should be_default_license
end
it "its independent-parent link points to an existing style" do
link = style.independent_parent_link
link.should match(%r{http://www.zotero.org/styles/([a-z-]+)})
Independents.should have_key(link[/[^\/]+$/])
end
it "has at least one info/category" do
style.info.should have_categories
end
it "has a citation-format" do
style.citation_format.should_not be_nil
end
it "has the same citation-format as its independent-parent" do
parent = style.independent_parent_link[/[^\/]+$/]
parent = Independents[parent][-1]
style.citation_format.should == parent.citation_format
end
end
end
end