Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
444 additions
and
643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
require 'simplecov' | ||
require 'roo' | ||
require 'vcr' | ||
require 'helpers' | ||
|
||
RSpec.configure do |c| | ||
c.include Helpers | ||
end | ||
|
||
VCR.configure do |c| | ||
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes' | ||
c.hook_into :webmock # or :fakeweb | ||
c.color = true | ||
c.formatter = :documentation | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'test_helper' | ||
|
||
class TestRooCSV < Minitest::Test | ||
def test_sheets | ||
file = filename("numbers1") | ||
workbook = roo_class.new(File.join(TESTDIR, file)) | ||
assert_equal ["default"], workbook.sheets | ||
assert_raises(RangeError) { workbook.default_sheet = "no_sheet" } | ||
assert_raises(TypeError) { workbook.default_sheet = [1, 2, 3] } | ||
workbook.sheets.each do |sh| | ||
workbook.default_sheet = sh | ||
assert_equal sh, workbook.default_sheet | ||
end | ||
end | ||
|
||
def test_nil_rows_and_lines_csv | ||
# x_123 | ||
oo = Roo::CSV.new(File.join(TESTDIR,'Bibelbund.csv')) | ||
oo.default_sheet = oo.sheets.first | ||
assert_equal 1, oo.first_row | ||
end | ||
|
||
def test_csv_parsing_with_headers | ||
return unless CSV | ||
headers = ["TITEL", "VERFASSER", "OBJEKT", "NUMMER", "SEITE", "INTERNET", "PC", "KENNUNG"] | ||
|
||
oo = Roo::Spreadsheet.open(File.join(TESTDIR, "Bibelbund.csv")) | ||
parsed = oo.parse(headers: true) | ||
assert_equal headers, parsed[1].keys | ||
end | ||
|
||
def roo_class | ||
Roo::CSV | ||
end | ||
|
||
def filename(name) | ||
"#{name}.csv" | ||
end | ||
end |
Oops, something went wrong.