xmlss 1.0.0.rc.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -2
- data/Gemfile +4 -5
- data/LICENSE.txt +22 -0
- data/{README.rdoc → README.md} +74 -71
- data/Rakefile +1 -7
- data/lib/xmlss/element/cell.rb +5 -0
- data/lib/xmlss/element/worksheet.rb +1 -0
- data/lib/xmlss/version.rb +1 -1
- data/lib/xmlss/writer.rb +53 -60
- data/test/helper.rb +6 -3
- data/test/unit/element/cell_tests.rb +124 -0
- data/test/{element/column_test.rb → unit/element/column_tests.rb} +14 -12
- data/test/{element/row_test.rb → unit/element/row_tests.rb} +14 -13
- data/test/{element/worksheet_test.rb → unit/element/worksheet_tests.rb} +16 -11
- data/test/{element_stack_test.rb → unit/element_stack_tests.rb} +5 -13
- data/test/{style/alignment_test.rb → unit/style/alignment_tests.rb} +17 -16
- data/test/{style/base_test.rb → unit/style/base_tests.rb} +7 -7
- data/test/{style/border_test.rb → unit/style/border_tests.rb} +18 -24
- data/test/{style/font_test.rb → unit/style/font_tests.rb} +8 -7
- data/test/{style/interior_test.rb → unit/style/interior_tests.rb} +6 -6
- data/test/{style/number_format_test.rb → unit/style/number_format_tests.rb} +6 -5
- data/test/{style/protection_test.rb → unit/style/protection_tests.rb} +2 -3
- data/test/{workbook_test.rb → unit/workbook_tests.rb} +2 -2
- data/test/{writer_test.rb → unit/writer_tests.rb} +20 -32
- data/xmlss.gemspec +20 -18
- metadata +58 -85
- data/Gemfile.lock +0 -33
- data/test/element/cell_test.rb +0 -117
- data/test/irb.rb +0 -10
- data/test/thing.rb +0 -9
data/Gemfile.lock
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
xmlss (1.0.0.rc.4)
|
5
|
-
enumeration (~> 1.3)
|
6
|
-
undies (~> 3.0.0.rc.3)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
ansi (1.4.2)
|
12
|
-
assert (0.7.3)
|
13
|
-
assert-view (~> 0.5)
|
14
|
-
assert-view (0.6.0)
|
15
|
-
ansi (~> 1.3)
|
16
|
-
enumeration (1.3.1)
|
17
|
-
rake (0.9.2)
|
18
|
-
ruby-prof (0.10.8)
|
19
|
-
undies (3.0.0.rc.3)
|
20
|
-
whysoslow (0.0.2)
|
21
|
-
ansi (~> 1.4)
|
22
|
-
|
23
|
-
PLATFORMS
|
24
|
-
ruby
|
25
|
-
|
26
|
-
DEPENDENCIES
|
27
|
-
assert (~> 0.7.3)
|
28
|
-
assert-view (~> 0.6)
|
29
|
-
bundler (~> 1.1)
|
30
|
-
rake (~> 0.9.2)
|
31
|
-
ruby-prof
|
32
|
-
whysoslow (~> 0.0)
|
33
|
-
xmlss!
|
data/test/element/cell_test.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
require "assert"
|
2
|
-
require 'enumeration/assert_macros'
|
3
|
-
|
4
|
-
require 'xmlss/element/cell'
|
5
|
-
|
6
|
-
module Xmlss::Element
|
7
|
-
|
8
|
-
class CellTests < Assert::Context
|
9
|
-
include Enumeration::AssertMacros
|
10
|
-
|
11
|
-
desc "Xmlss::Cell"
|
12
|
-
before { @c = Cell.new }
|
13
|
-
subject { @c }
|
14
|
-
|
15
|
-
should be_styled
|
16
|
-
should have_class_method :writer
|
17
|
-
should have_accessor :index, :formula, :href, :merge_across, :merge_down
|
18
|
-
|
19
|
-
should have_enum :type, {
|
20
|
-
:number => "Number",
|
21
|
-
:date_time => "DateTime",
|
22
|
-
:boolean => "Boolean",
|
23
|
-
:string => "String",
|
24
|
-
:error => "Error"
|
25
|
-
}
|
26
|
-
|
27
|
-
should have_accessor :data
|
28
|
-
should have_instance_method :data_xml_value
|
29
|
-
|
30
|
-
should "know its writer hook" do
|
31
|
-
assert_equal :cell, subject.class.writer
|
32
|
-
end
|
33
|
-
|
34
|
-
should "set it's defaults" do
|
35
|
-
assert_nil subject.formula
|
36
|
-
assert_nil subject.href
|
37
|
-
assert_nil subject.merge_across
|
38
|
-
assert_nil subject.merge_down
|
39
|
-
|
40
|
-
assert_equal Cell.type(:string), subject.type
|
41
|
-
assert_equal "", subject.data
|
42
|
-
end
|
43
|
-
|
44
|
-
should "bark when setting non Fixnum indices" do
|
45
|
-
assert_raises ArgumentError do
|
46
|
-
Cell.new({:index => "do it"})
|
47
|
-
end
|
48
|
-
assert_raises ArgumentError do
|
49
|
-
Cell.new({:index => 2.5})
|
50
|
-
end
|
51
|
-
assert_nothing_raised do
|
52
|
-
Cell.new({:index => 2})
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
should "bark when setting non Fixnum merge attrs" do
|
57
|
-
assert_raises ArgumentError do
|
58
|
-
Cell.new({:merge_across => "do it"})
|
59
|
-
end
|
60
|
-
assert_raises ArgumentError do
|
61
|
-
Cell.new({:merge_down => 2.5})
|
62
|
-
end
|
63
|
-
assert_nothing_raised do
|
64
|
-
Cell.new({:merge_across => 2})
|
65
|
-
end
|
66
|
-
assert_nothing_raised do
|
67
|
-
Cell.new({:merge_down => 3})
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
should "nil out merge/index values that are <= 0" do
|
72
|
-
[:index, :merge_across, :merge_down].each do |a|
|
73
|
-
assert_equal nil, Cell.new({a => -1}).send(a)
|
74
|
-
assert_equal nil, Cell.new({a => 0}).send(a)
|
75
|
-
assert_equal 1, Cell.new({a => 1}).send(a)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
should "generate it's data xml value" do
|
80
|
-
assert_equal "12", Cell.new(12).data_xml_value
|
81
|
-
assert_equal "string", Cell.new(:data => "string").data_xml_value
|
82
|
-
assert_equal "2011-03-01T00:00:00", Cell.new(DateTime.parse('2011/03/01')).data_xml_value
|
83
|
-
assert_equal "2011-03-01T00:00:00", Cell.new(Date.parse('2011/03/01')).data_xml_value
|
84
|
-
time = Time.now
|
85
|
-
assert_equal time.strftime("%Y-%m-%dT%H:%M:%S"), Cell.new(time).data_xml_value
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
class ExplicitDataTest < CellTests
|
91
|
-
desc "when using explicit data type"
|
92
|
-
subject do
|
93
|
-
Cell.new(12, {:type => :string})
|
94
|
-
end
|
95
|
-
|
96
|
-
should "should ignore the data value's implied type" do
|
97
|
-
assert_equal Cell.type(:string), subject.type
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
class NoTypeDataTest < CellTests
|
103
|
-
desc "when no data type is specified"
|
104
|
-
|
105
|
-
should "cast types for Number, DateTime, Boolean, String" do
|
106
|
-
assert_equal Cell.type(:number), Cell.new(12).type
|
107
|
-
assert_equal Cell.type(:number), Cell.new(:data => 123.45).type
|
108
|
-
assert_equal Cell.type(:date_time), Cell.new(Time.now).type
|
109
|
-
assert_equal Cell.type(:boolean), Cell.new(true).type
|
110
|
-
assert_equal Cell.type(:boolean), Cell.new(false).type
|
111
|
-
assert_equal Cell.type(:string), Cell.new("a string").type
|
112
|
-
assert_equal Cell.type(:string), Cell.new(:data => :symbol).type
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
data/test/irb.rb
DELETED