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
|
# frozen_string_literal: true
require 'application_system_test_case'
class BaseExporterTest < ApplicationSystemTestCase
test 'parse authors works' do
instance = BaseExporter.new(things: [])
[
['Name Surname', %w[Name Surname]],
['Name', ['Name', nil]],
['Compound Name Surname', ['Compound Name', 'Surname']],
['Name _Underscored Surname_', ['Name', 'Underscored Surname']],
['_Name in underscores_', ['Name in underscores', nil]]
].each do |row|
got = instance.send(:parse_author, author: row[0])
assert_equal got[0], row[1][0]
if row[1][1]
assert_equal got[1], row[1][1]
else
assert_nil got[1]
end
end
end
end
|