-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathrepository_spec.rb
32 lines (26 loc) · 935 Bytes
/
repository_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
describe "The file \"publishers.json\"" do
before(:all) do
publishers_file_path = File.join("#{JOURNALS_ROOT}", "publishers.json")
@publishers_file_exists = File.exist?(publishers_file_path)
@publishers_file_validates = false
begin
@publishers = JSON.parse(File.read(publishers_file_path))
@publishers_file_validates = true
rescue JSON::ParserError => e
end
@data_directories = Dir.foreach(JOURNALS_ROOT).select { |subdirectory| File.file? "#{JOURNALS_ROOT}/#{subdirectory}/_template.csl"}
end
it "must be present" do
expect(@publishers_file_exists).to be true
end
it "must be valid JSON" do
if @publishers_file_exists
expect(@publishers_file_validates).to be true
end
end
it "must contain a description for every metadata folder" do
if @publishers_file_validates
expect(@data_directories - @publishers.keys).to eq([])
end
end
end