spec/excel_spec.rb in datashift-0.13.0 vs spec/excel_spec.rb in datashift-0.14.0
- old
+ new
@@ -37,16 +37,37 @@
sheet.name.should == "daft punk"
sheet2 = @excel.create_worksheet( :name => "underworld")
sheet2.name.should == "underworld"
end
+
+ it "can sanitize worksheet names as per Excel spec" do
+
+ include ExcelBase
+ extend ExcelBase
+
+ # name.gsub(/[\[\]:\*\/\\\?]/, '
+
+ sanitize_sheet_name("aute?chre").should == "autechre"
+ sanitize_sheet_name("?autechre").should == "autechre"
+ sanitize_sheet_name("aute?chre?").should == "autechre"
+
+ sanitize_sheet_name("daft: ?punk").should == "daft punk"
+ sanitize_sheet_name("guy call[]ed *Gerald").should == "guy called Gerald"
+
+ sanitize_sheet_name("guy called */Gerald").should == "guy called Gerald"
+ end
- it "ensures name of worksheet sanitized" do
- sheet = @excel.create_worksheet( :name => "daft: ?punk")
- sheet.name.should == "daft punk"
+ # Pending - inject create_worksheet method into Spreadsheet gem
+ if(DataShift::Guards.jruby?)
+ it "ensures name of worksheet sanitized" do
- sheet = @excel.create_worksheet( :name => "under[]world")
- sheet.name.should == "underworld"
+ sheet = @excel.create_worksheet( :name => "daft: ?punk")
+ sheet.name.should == "daft punk"
+
+ sheet = @excel.create_worksheet( :name => "under[]world")
+ sheet.name.should == "underworld"
+ end
end
it "can create multiple named worksheets" do
@excel.create_worksheet( :name => "underworld")