xmlss 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +28 -0
  4. data/README.rdoc +154 -0
  5. data/Rakefile +7 -0
  6. data/examples/example_workbook.rb +19 -0
  7. data/examples/layout.rb +81 -0
  8. data/examples/simple.rb +30 -0
  9. data/examples/styles.rb +85 -0
  10. data/examples/text.rb +36 -0
  11. data/lib/xmlss/cell.rb +38 -0
  12. data/lib/xmlss/column.rb +28 -0
  13. data/lib/xmlss/data.rb +67 -0
  14. data/lib/xmlss/enum.rb +56 -0
  15. data/lib/xmlss/item_set.rb +17 -0
  16. data/lib/xmlss/row.rb +34 -0
  17. data/lib/xmlss/style/alignment.rb +47 -0
  18. data/lib/xmlss/style/base.rb +63 -0
  19. data/lib/xmlss/style/border.rb +43 -0
  20. data/lib/xmlss/style/font.rb +41 -0
  21. data/lib/xmlss/style/interior.rb +41 -0
  22. data/lib/xmlss/style/number_format.rb +20 -0
  23. data/lib/xmlss/style/protection.rb +18 -0
  24. data/lib/xmlss/table.rb +22 -0
  25. data/lib/xmlss/version.rb +3 -0
  26. data/lib/xmlss/workbook.rb +33 -0
  27. data/lib/xmlss/worksheet.rb +37 -0
  28. data/lib/xmlss/xml.rb +55 -0
  29. data/lib/xmlss.rb +31 -0
  30. data/test/cell_test.rb +86 -0
  31. data/test/column_test.rb +46 -0
  32. data/test/data_test.rb +75 -0
  33. data/test/enum_test.rb +63 -0
  34. data/test/env.rb +10 -0
  35. data/test/helper.rb +49 -0
  36. data/test/item_set_test.rb +26 -0
  37. data/test/row_test.rb +67 -0
  38. data/test/style/alignment_test.rb +107 -0
  39. data/test/style/base_test.rb +126 -0
  40. data/test/style/border_test.rb +114 -0
  41. data/test/style/font_test.rb +100 -0
  42. data/test/style/interior_test.rb +87 -0
  43. data/test/style/number_format_test.rb +50 -0
  44. data/test/style/protection_test.rb +45 -0
  45. data/test/table_test.rb +53 -0
  46. data/test/thing.rb +5 -0
  47. data/test/workbook_test.rb +59 -0
  48. data/test/worksheet_test.rb +62 -0
  49. data/test/xml_test.rb +61 -0
  50. data/test/xmlss_test.rb +29 -0
  51. data/xmlss.gemspec +23 -0
  52. metadata +184 -0
data/test/data_test.rb ADDED
@@ -0,0 +1,75 @@
1
+ require "test/helper"
2
+ require 'xmlss/data'
3
+
4
+ module Xmlss
5
+ class DataTest < Test::Unit::TestCase
6
+
7
+ context "Xmlss::Data" do
8
+ subject { Data.new }
9
+
10
+ should_have_accessor :type, :value
11
+ should_have_instance_method :xml_value
12
+
13
+ should "set it's defaults" do
14
+ assert_equal Data.type(:string), subject.type
15
+ assert_equal "", subject.value
16
+ end
17
+
18
+ should "generate it's xml value" do
19
+ assert_equal "12", Data.new(12).xml_value
20
+ assert_equal "string", Data.new("string").xml_value
21
+ assert_equal "line#{Data::LB}break", Data.new("line\nbreak").xml_value
22
+ assert_equal "return#{Data::LB}break", Data.new("return\rbreak").xml_value
23
+ assert_equal "returnline#{Data::LB}break", Data.new("returnline\r\nbreak").xml_value
24
+ assert_equal "2011-03-01T00:00:00", Data.new(DateTime.parse('03/01/2011')).xml_value
25
+ assert_equal "2011-03-01T00:00:00", Data.new(Date.parse('03/01/2011')).xml_value
26
+ time = Time.now
27
+ assert_equal time.strftime("%Y-%m-%dT%H:%M:%S"), Data.new(time).xml_value
28
+ end
29
+
30
+ context "when using explicit type" do
31
+ subject do
32
+ Data.new(12, {:type => :string})
33
+ end
34
+
35
+ should "should ignore the value type" do
36
+ assert_equal Data.type(:string), subject.type
37
+ end
38
+ end
39
+
40
+ context "when no type is specified" do
41
+ should "cast types for Number, DateTime, Boolean, String" do
42
+ assert_equal Data.type(:number), Data.new(12).type
43
+ assert_equal Data.type(:number), Data.new(123.45).type
44
+ assert_equal Data.type(:date_time), Data.new(Time.now).type
45
+ assert_equal Data.type(:boolean), Data.new(true).type
46
+ assert_equal Data.type(:boolean), Data.new(false).type
47
+ assert_equal Data.type(:string), Data.new("a string").type
48
+ assert_equal Data.type(:string), Data.new(:symbol).type
49
+ end
50
+ end
51
+
52
+ context "dealing with line breaks and leading space" do
53
+ subject do
54
+ Data.new(%s{
55
+ Should
56
+ honor
57
+ this
58
+ })
59
+ end
60
+
61
+ should "honor them when generating xml" do
62
+ reg = /#{Data::LB}Should#{Data::LB}\s{2}honor#{Data::LB}\s{4}this#{Data::LB}/
63
+ assert_match reg, subject.xml_value
64
+ end
65
+ end
66
+
67
+ context "for generating XML" do
68
+ should_have_reader :xml
69
+ should_build_node
70
+ end
71
+
72
+ end
73
+
74
+ end
75
+ end
data/test/enum_test.rb ADDED
@@ -0,0 +1,63 @@
1
+ require "test/helper"
2
+ require 'xmlss/enum'
3
+ require 'test/thing'
4
+
5
+ module Xmlss
6
+ class EnumTest < Test::Unit::TestCase
7
+
8
+ context "Xmlss::Enum mixin" do
9
+ subject { Thing.new }
10
+ before do
11
+ Thing.send :include, Xmlss::Enum
12
+ end
13
+
14
+ should_have_class_method :enum
15
+
16
+ context "instance" do
17
+ before do
18
+ Thing.send(:enum, :stuff, {
19
+ :a => "eh",
20
+ :b => "bee",
21
+ :c => "see"
22
+ })
23
+ end
24
+
25
+ should_have_class_method :stuff
26
+ should "provide class level access to the enum" do
27
+ assert Thing.send(:class_variable_get, "@@stuff")
28
+ assert_equal 3, Thing.send(:class_variable_get, "@@stuff").size
29
+ assert_equal "eh", Thing.stuff(:a)
30
+ end
31
+
32
+ should_have_accessor :stuff
33
+
34
+ should "write by key and read by value" do
35
+ subject.stuff = :a
36
+ assert_equal "eh", subject.stuff
37
+ end
38
+
39
+ should "write by value and read by value" do
40
+ subject.stuff = "bee"
41
+ assert_equal "bee", subject.stuff
42
+ end
43
+
44
+ should "not read by key" do
45
+ subject.stuff = :c
46
+ assert_not_equal :c, subject.stuff
47
+ end
48
+
49
+ should "write nil for keys that aren't in the enum" do
50
+ subject.stuff = :bad
51
+ assert_equal nil, subject.stuff
52
+ end
53
+
54
+ should "write nil for values that aren't in the enum" do
55
+ subject.stuff = "bady-bad"
56
+ assert_equal nil, subject.stuff
57
+ end
58
+
59
+ end
60
+ end
61
+
62
+ end
63
+ end
data/test/env.rb ADDED
@@ -0,0 +1,10 @@
1
+ # Add test and lib paths to the $LOAD_PATH
2
+ [ File.dirname(__FILE__),
3
+ File.join(File.dirname(__FILE__), '..', 'lib')
4
+ ].each do |path|
5
+ full_path = File.expand_path(path)
6
+ $LOAD_PATH.unshift(full_path) unless $LOAD_PATH.include?(full_path)
7
+ end
8
+
9
+ require 'xmlss'
10
+
data/test/helper.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+ require 'test_belt'
3
+ require 'test/env'
4
+
5
+ class Test::Unit::TestCase
6
+
7
+ class << self
8
+
9
+ def should_build_node
10
+ should_have_instance_methods :build_node
11
+ should "build it's node" do
12
+ assert_nothing_raised do
13
+ ::Nokogiri::XML::Builder.new do |builder|
14
+ subject.build_node(builder)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ def should_build_no_attributes_by_default(klass)
21
+ context "by default" do
22
+ subject{ klass.new }
23
+
24
+ should "have no element attributes" do
25
+ assert_equal({}, subject.send(:build_attributes))
26
+ end
27
+ end
28
+ end
29
+
30
+ def should_have_style(klass)
31
+ should_have_accessor :style_id
32
+ should_have_reader :style_i_d
33
+
34
+ should "set the style default" do
35
+ assert_equal nil, subject.style_id
36
+ end
37
+
38
+ should "provide aliases for style_id" do
39
+ c = klass.new({:style_id => :poo})
40
+ assert_equal :poo, c.style_id
41
+ assert_equal :poo, c.style_i_d
42
+ end
43
+
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,26 @@
1
+ require "test/helper"
2
+ require 'xmlss/item_set'
3
+
4
+ module Xmlss
5
+ class ItemSetTest < Test::Unit::TestCase
6
+
7
+ context "Xmlss::ItemSet" do
8
+ subject { ItemSet.new(:test) }
9
+
10
+ should_have_reader :name
11
+
12
+ should "be an Array" do
13
+ assert_kind_of ::Array, subject
14
+ assert_respond_to subject, :each
15
+ assert subject.empty?
16
+ end
17
+
18
+ context "for generating XML" do
19
+ should_have_reader :xml
20
+ should_build_node
21
+ should_build_no_attributes_by_default(ItemSet)
22
+ end
23
+ end
24
+
25
+ end
26
+ end
data/test/row_test.rb ADDED
@@ -0,0 +1,67 @@
1
+ require "test/helper"
2
+ require 'xmlss/row'
3
+
4
+ module Xmlss
5
+ class RowTest < Test::Unit::TestCase
6
+
7
+ context "Xmlss::Row" do
8
+ subject { Row.new }
9
+
10
+ should_have_style(Row)
11
+ should_have_accessor :height, :auto_fit_height, :hidden
12
+ should_have_accessor :cells
13
+
14
+ should "set it's defaults" do
15
+ assert_equal nil, subject.height
16
+ assert_equal false, subject.auto_fit_height
17
+ assert_equal false, subject.hidden
18
+ assert_equal [], subject.cells
19
+ end
20
+
21
+ should "allow defining a cells at init" do
22
+ row = Row.new({
23
+ :cells => [Cell.new]
24
+ })
25
+
26
+ assert_equal 1, row.cells.size
27
+ assert_kind_of Cell, row.cells.first
28
+ end
29
+
30
+ should "bark when setting non Numeric height" do
31
+ assert_raises ArgumentError do
32
+ Row.new({:height => "do it"})
33
+ end
34
+ assert_nothing_raised do
35
+ Row.new({:height => 2})
36
+ end
37
+ assert_nothing_raised do
38
+ Row.new({:height => 3.5})
39
+ end
40
+ end
41
+
42
+ should "nil out height values that are < 0" do
43
+ assert_equal nil, Row.new({:height => -1.2}).height
44
+ assert_equal nil, Row.new({:height => -1}).height
45
+ assert_equal 0, Row.new({:height => 0}).height
46
+ assert_equal 1.2, Row.new({:height => 1.2}).height
47
+ end
48
+
49
+
50
+ context "when using cells" do
51
+ before { subject.cells << Cell.new }
52
+
53
+ should "should build a data object" do
54
+ assert_equal 1, subject.cells.size
55
+ assert_kind_of Cell, subject.cells.first
56
+ end
57
+ end
58
+
59
+ context "for generating XML" do
60
+ should_have_reader :xml
61
+ should_build_node
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,107 @@
1
+ require "test/helper"
2
+ require 'xmlss/style/alignment'
3
+
4
+ class Xmlss::Style::AlignmentTest < Test::Unit::TestCase
5
+
6
+ context "Xmlss::Style::Alignment" do
7
+ subject { Xmlss::Style::Alignment.new }
8
+
9
+ should_have_class_method :horizontal
10
+ {
11
+ :automatic => "Automatic",
12
+ :left => "Left",
13
+ :center => "Center",
14
+ :right => "Right"
15
+ }.each do |horizontal, value|
16
+ should "provide the value for the '#{horizontal}' horizontal" do
17
+ assert_equal value, Xmlss::Style::Alignment.horizontal(horizontal)
18
+ end
19
+ end
20
+
21
+ should_have_class_method :vertical
22
+ {
23
+ :automatic => "Automatic",
24
+ :top => "Top",
25
+ :center => "Center",
26
+ :bottom => "Bottom"
27
+ }.each do |vertical, value|
28
+ should "provide the value for the '#{vertical}' vertical" do
29
+ assert_equal value, Xmlss::Style::Alignment.vertical(vertical)
30
+ end
31
+ end
32
+
33
+ should_have_accessors :horizontal, :vertical, :wrap_text, :rotate
34
+ should_have_instance_methods :wrap_text?
35
+
36
+ should "set it's defaults" do
37
+ assert_equal false, subject.wrap_text
38
+ assert_equal nil, subject.horizontal
39
+ assert_equal nil, subject.vertical
40
+ assert_equal nil, subject.rotate
41
+ end
42
+
43
+ context "that sets attributes at init" do
44
+ before do
45
+ @attrs = {
46
+ :wrap_text => true,
47
+ :horizontal => :center,
48
+ :vertical => :bottom,
49
+ :rotate => 90
50
+ }
51
+ @alignment = Xmlss::Style::Alignment.new(@attrs)
52
+ end
53
+ subject{ @alignment }
54
+
55
+ should "should set them correctly" do
56
+ @attrs.reject{|a, v| [:horizontal, :vertical].include?(a)}.each do |a,v|
57
+ assert_equal v, subject.send(a)
58
+ end
59
+ assert_equal Xmlss::Style::Alignment.horizontal(:center), subject.horizontal
60
+ assert_equal Xmlss::Style::Alignment.vertical(:bottom), subject.vertical
61
+ end
62
+ end
63
+
64
+ should "reject invalid rotate alignments" do
65
+ assert_equal nil, Xmlss::Style::Alignment.new({:rotate => 100}).rotate
66
+ assert_equal 90, Xmlss::Style::Alignment.new({:rotate => 90}).rotate
67
+ assert_equal 0, Xmlss::Style::Alignment.new({:rotate => 0}).rotate
68
+ assert_equal -90, Xmlss::Style::Alignment.new({:rotate => -90}).rotate
69
+ assert_equal nil, Xmlss::Style::Alignment.new({:rotate => -100}).rotate
70
+ assert_equal 0, Xmlss::Style::Alignment.new({:rotate => 0.2}).rotate
71
+ assert_equal 1, Xmlss::Style::Alignment.new({:rotate => 0.5}).rotate
72
+ assert_equal nil, Xmlss::Style::Alignment.new({:rotate => "poo"}).rotate
73
+ assert_equal nil, Xmlss::Style::Alignment.new({:rotate => :poo}).rotate
74
+ end
75
+
76
+ context "that sets underline and alignment by key" do
77
+ before do
78
+ subject.horizontal = :left
79
+ subject.vertical = :top
80
+ end
81
+
82
+ should "should returm it by value" do
83
+ assert_equal Xmlss::Style::Alignment.horizontal(:left), subject.horizontal
84
+ assert_equal Xmlss::Style::Alignment.vertical(:top), subject.vertical
85
+ end
86
+ end
87
+
88
+ context "that sets underline and alignment by value" do
89
+ before do
90
+ subject.horizontal = Xmlss::Style::Alignment.horizontal(:right)
91
+ subject.vertical = Xmlss::Style::Alignment.vertical(:center)
92
+ end
93
+
94
+ should "should returm it by value" do
95
+ assert_equal Xmlss::Style::Alignment.horizontal(:right), subject.horizontal
96
+ assert_equal Xmlss::Style::Alignment.vertical(:center), subject.vertical
97
+ end
98
+ end
99
+
100
+ context "for generating XML" do
101
+ should_have_reader :xml
102
+ should_build_node
103
+ should_build_no_attributes_by_default(Xmlss::Style::Alignment)
104
+ end
105
+
106
+ end
107
+ end
@@ -0,0 +1,126 @@
1
+ require "test/helper"
2
+ require 'xmlss/style/base'
3
+
4
+ class Xmlss::Style::BaseTest < Test::Unit::TestCase
5
+ context "Xmlss::Style::Base" do
6
+ subject { Xmlss::Style::Base.new(:test) }
7
+
8
+ should_have_reader :id, :i_d, :border
9
+ should_have_accessors :borders, :alignment, :font
10
+ should_have_accessors :interior, :number_format, :protection
11
+
12
+ should "bark if you don't init with an id" do
13
+ assert_raises ArgumentError do
14
+ Xmlss::Style::Base.new(nil)
15
+ end
16
+ end
17
+
18
+ should "force string ids" do
19
+ assert_equal 'string', Xmlss::Style::Base.new('string').id
20
+ assert_equal 'symbol', Xmlss::Style::Base.new(:symbol).id
21
+ assert_equal '123', Xmlss::Style::Base.new(123).id
22
+ end
23
+
24
+ should "set it's defaults" do
25
+ assert_equal 'test', subject.id
26
+ assert_equal [], subject.borders
27
+ [ :alignment, :border, :font,
28
+ :interior, :number_format, :protection
29
+ ].each do |s|
30
+ assert_equal nil, subject.send(s)
31
+ end
32
+ end
33
+
34
+ context "that sets alignment" do
35
+ subject do
36
+ Xmlss::Style::Base.new(:alignment) do
37
+ alignment(
38
+ :horizontal => :left,
39
+ :vertical => :center,
40
+ :wrap_text => true
41
+ )
42
+ end
43
+ end
44
+
45
+ should "should create an Alignment object" do
46
+ assert_kind_of Xmlss::Style::Alignment, subject.alignment
47
+ assert_equal true, subject.alignment.wrap_text
48
+ assert_equal Xmlss::Style::Alignment.horizontal(:left), subject.alignment.horizontal
49
+ assert_equal Xmlss::Style::Alignment.vertical(:center), subject.alignment.vertical
50
+ end
51
+ end
52
+
53
+ context "that sets borders" do
54
+ subject do
55
+ Xmlss::Style::Base.new(:borders) do
56
+ border(:position => :left)
57
+ border(:position => :right)
58
+ end
59
+ end
60
+
61
+ should "should create Border objects and add them to its borders" do
62
+ assert_equal 2, subject.borders.size
63
+ assert_kind_of Xmlss::Style::Border, subject.borders.first
64
+ assert_equal Xmlss::Style::Border.position(:left), subject.borders.first.position
65
+ assert_equal Xmlss::Style::Border.position(:right), subject.borders.last.position
66
+ end
67
+
68
+ should "error if manually setting borders to non ItemSet collection" do
69
+ assert_raises ArgumentError do
70
+ subject.borders = []
71
+ end
72
+ end
73
+ end
74
+
75
+ context "that sets font" do
76
+ subject do
77
+ Xmlss::Style::Base.new(:font) { font(:bold => true) }
78
+ end
79
+
80
+ should "should create a Font object" do
81
+ assert_kind_of Xmlss::Style::Font, subject.font
82
+ assert subject.font.bold?
83
+ end
84
+ end
85
+
86
+ context "that sets interior" do
87
+ subject do
88
+ Xmlss::Style::Base.new(:interior) { interior(:color => "#000000") }
89
+ end
90
+
91
+ should "should create an Interior object" do
92
+ assert_kind_of Xmlss::Style::Interior, subject.interior
93
+ assert_equal "#000000", subject.interior.color
94
+ end
95
+ end
96
+
97
+ context "that sets number format" do
98
+ subject do
99
+ Xmlss::Style::Base.new(:number_format) { number_format(:format => "General") }
100
+ end
101
+
102
+ should "should create a NumberFormat object" do
103
+ assert_kind_of Xmlss::Style::NumberFormat, subject.number_format
104
+ assert_equal "General", subject.number_format.format
105
+ end
106
+ end
107
+
108
+ context "that sets protection" do
109
+ subject do
110
+ Xmlss::Style::Base.new(:protection) { protection(:protect => true) }
111
+ end
112
+
113
+ should "should create a Protection object" do
114
+ assert_kind_of Xmlss::Style::Protection, subject.protection
115
+ assert subject.protection.protected?
116
+ end
117
+ end
118
+
119
+ context "for generating XML" do
120
+ should_have_reader :xml
121
+ should_build_node
122
+ should_build_no_attributes_by_default(Xmlss::Style::Alignment)
123
+ end
124
+
125
+ end
126
+ end
@@ -0,0 +1,114 @@
1
+ require "test/helper"
2
+ require 'xmlss/style/border'
3
+
4
+ class Xmlss::Style::BorderTest < Test::Unit::TestCase
5
+
6
+ context "Xmlss::Style::Border" do
7
+ subject { Xmlss::Style::Border.new }
8
+
9
+ should_have_class_method :position
10
+ {
11
+ :left => "Left",
12
+ :top => "Top",
13
+ :right => "Right",
14
+ :bottom => "Bottom",
15
+ :diagonal_left => "DiagonalLeft",
16
+ :diagonal_right => "DiagonalRight"
17
+ }.each do |position, value|
18
+ should "provide the value for the '#{position}' position" do
19
+ assert_equal value, Xmlss::Style::Border.position(position)
20
+ end
21
+ end
22
+
23
+ should_have_class_method :weight
24
+ {
25
+ :hairline => 0,
26
+ :thin => 1,
27
+ :medium => 2,
28
+ :thick => 3
29
+ }.each do |weight, value|
30
+ should "provide the value for the '#{weight}' weight" do
31
+ assert_equal value, Xmlss::Style::Border.weight(weight)
32
+ end
33
+ end
34
+
35
+ should_have_class_method :line_style
36
+ {
37
+ :none => "None",
38
+ :continuous => "Continuous",
39
+ :dash => "Dash",
40
+ :dot => "Dot",
41
+ :dash_dot => "DashDot",
42
+ :dash_dot_dot => "DashDotDot"
43
+ }.each do |style, value|
44
+ should "provide the value for the '#{style}' line_style" do
45
+ assert_equal value, Xmlss::Style::Border.line_style(style)
46
+ end
47
+ end
48
+
49
+ should_have_accessors :color, :position, :weight, :line_style
50
+
51
+ should "set it's defaults" do
52
+ assert_equal nil, subject.color
53
+ assert_equal nil, subject.position
54
+ assert_equal Xmlss::Style::Border.weight(:thin), subject.weight
55
+ assert_equal Xmlss::Style::Border.line_style(:continuous), subject.line_style
56
+ end
57
+
58
+ context "that sets attributes at init" do
59
+ before do
60
+ @attrs = {
61
+ :color => '#FF0000',
62
+ :position => :top,
63
+ :weight => :thick,
64
+ :line_style => :dot
65
+ }
66
+ @border = Xmlss::Style::Border.new(@attrs)
67
+ end
68
+ subject{ @border }
69
+
70
+ should "should set them correctly" do
71
+ @attrs.reject{|a, v| [:position, :weight, :line_style].include?(a)}.each do |a,v|
72
+ assert_equal v, subject.send(a)
73
+ end
74
+ assert_equal Xmlss::Style::Border.position(:top), subject.position
75
+ assert_equal Xmlss::Style::Border.weight(:thick), subject.weight
76
+ assert_equal Xmlss::Style::Border.line_style(:dot), subject.line_style
77
+ end
78
+ end
79
+
80
+ context "that sets position, weight, and style by key" do
81
+ before do
82
+ subject.position = :bottom
83
+ subject.weight = :medium
84
+ subject.line_style = :dash_dot
85
+ end
86
+
87
+ should "should returm it by value" do
88
+ assert_equal Xmlss::Style::Border.position(:bottom), subject.position
89
+ assert_equal Xmlss::Style::Border.weight(:medium), subject.weight
90
+ assert_equal Xmlss::Style::Border.line_style(:dash_dot), subject.line_style
91
+ end
92
+ end
93
+
94
+ context "that sets position, weight, and style by value" do
95
+ before do
96
+ subject.position = Xmlss::Style::Border.position(:bottom)
97
+ subject.weight = Xmlss::Style::Border.weight(:medium)
98
+ subject.line_style = Xmlss::Style::Border.line_style(:dash_dot)
99
+ end
100
+
101
+ should "should returm it by value" do
102
+ assert_equal Xmlss::Style::Border.position(:bottom), subject.position
103
+ assert_equal Xmlss::Style::Border.weight(:medium), subject.weight
104
+ assert_equal Xmlss::Style::Border.line_style(:dash_dot), subject.line_style
105
+ end
106
+ end
107
+
108
+ context "for generating XML" do
109
+ should_have_reader :xml
110
+ should_build_node
111
+ end
112
+
113
+ end
114
+ end