summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml6
-rw-r--r--lib/axlsx/package.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb2
-rw-r--r--test/tc_helper.rb4
-rw-r--r--test/tc_package.rb5
5 files changed, 16 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml
index aa9aad0a..657f9173 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,10 +15,10 @@ notifications:
matrix:
include:
- rvm: 2.1
- - rvm: 2.2.7
- - rvm: 2.3.4
+ - rvm: 2.2.8
+ - rvm: 2.3.5
- rvm: 2.0.0
- - rvm: 2.4.1
+ - rvm: 2.4.2
- rvm: rbx-3
- rvm: jruby-19mode
env: JRUBY_OPTS="-Xcli.debug=true --debug"
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 8a4f29dc..5b5ea14a 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -1,4 +1,4 @@
-# encoding: UTF-8
+# encoding: utf-8
module Axlsx
# Package is responsible for managing all the bits and peices that Open Office XML requires to make a valid
# xlsx document including valdation and serialization.
@@ -253,7 +253,9 @@ module Axlsx
parts << {:entry => "xl/#{sheet.rels_pn}", :doc => sheet.relationships, :schema => RELS_XSD}
parts << {:entry => "xl/#{sheet.pn}", :doc => sheet, :schema => SML_XSD}
end
- parts
+
+ # Sort parts for correct MIME detection
+ parts.sort_by { |part| part[:entry] }
end
# Performs xsd validation for a signle document
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index d39bf069..f094c5cd 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -152,7 +152,7 @@ module Axlsx
# cell at a specific index. The block will be called with the row and column
# index in the missing cell was found.
# @example
- # cols { |row_index, column_index| p "warn - row #{row_index} is does not have a cell at #{column_index}
+ # cols { |row_index, column_index| puts "warn - row #{row_index} does not have a cell at #{column_index}" }
def cols(&block)
@rows.transpose(&block)
end
diff --git a/test/tc_helper.rb b/test/tc_helper.rb
index 96f545cd..396f19b2 100644
--- a/test/tc_helper.rb
+++ b/test/tc_helper.rb
@@ -7,4 +7,6 @@ end
require 'test/unit'
require "timecop"
-require "axlsx.rb" \ No newline at end of file
+require "axlsx.rb"
+# MIME detection for Microsoft Office 2007+ formats
+require 'mimemagic/overlay'
diff --git a/test/tc_package.rb b/test/tc_package.rb
index 0ad27f7d..58ff53b0 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -154,6 +154,11 @@ class TestPackage < Test::Unit::TestCase
assert package_1.to_stream.string == package_2.to_stream.string, "zip files are not identical"
end
+ def test_serialization_creates_files_with_excel_mime_type
+ assert_equal(MimeMagic.by_magic(@package.to_stream).type,
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
+ end
+
def test_validation
assert_equal(@package.validate.size, 0, @package.validate)
Axlsx::Workbook.send(:class_variable_set, :@@date1904, 9900)