forked from roo-rb/roo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use our old Excelx::FORMATS hash to spec out the new implementation. …
…Support some (mildly dubious) exceptions for backwards compatibility.
- Loading branch information
Showing
5 changed files
with
123 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ gemspec | |
# additional testing libs | ||
gem 'webmock' | ||
gem 'shoulda' | ||
gem 'rspec' |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require 'spec_helper' | ||
|
||
describe Roo::Excelx::Format do | ||
describe '#to_type' do | ||
FORMATS = { | ||
'General' => :float, | ||
'0' => :float, | ||
'0.00' => :float, | ||
'#,##0' => :float, | ||
'#,##0.00' => :float, | ||
'0%' => :percentage, | ||
'0.00%' => :percentage, | ||
'0.00E+00' => :float, | ||
'# ?/?' => :float, #??? TODO: | ||
'# ??/??' => :float, #??? TODO: | ||
'mm-dd-yy' => :date, | ||
'd-mmm-yy' => :date, | ||
'd-mmm' => :date, | ||
'mmm-yy' => :date, | ||
'h:mm AM/PM' => :date, | ||
'h:mm:ss AM/PM' => :date, | ||
'h:mm' => :time, | ||
'h:mm:ss' => :time, | ||
'm/d/yy h:mm' => :date, | ||
'#,##0 ;(#,##0)' => :float, | ||
'#,##0 ;[Red](#,##0)' => :float, | ||
'#,##0.00;(#,##0.00)' => :float, | ||
'#,##0.00;[Red](#,##0.00)' => :float, | ||
'mm:ss' => :time, | ||
'[h]:mm:ss' => :time, | ||
'mmss.0' => :time, | ||
'##0.0E+0' => :float, | ||
'@' => :float, | ||
#-- zusaetzliche Formate, die nicht standardmaessig definiert sind: | ||
"yyyy\\-mm\\-dd" => :date, | ||
'dd/mm/yy' => :date, | ||
'hh:mm:ss' => :time, | ||
"dd/mm/yy\\ hh:mm" => :datetime, | ||
'dd/mmm/yy' => :date, # 2011-05-21 | ||
'yyyy-mm-dd' => :date, # 2011-09-16 | ||
'yyyy-mm-dd;@' => :date | ||
}.each do |format, type| | ||
it "translates #{format} to #{type}" do | ||
Roo::Excelx::Format.to_type(format).should == type | ||
end | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require File.expand_path("../../lib/roo", __FILE__) |