xmlss 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require 'xmlss/style/border'
3
3
 
4
- class Xmlss::Style::BorderTest < Test::Unit::TestCase
4
+ module Xmlss::Style
5
+ class BorderTest < Assert::Context
6
+ desc "Xmlss::Style::Border"
7
+ before { @b = Xmlss::Style::Border.new }
8
+ subject { @b }
5
9
 
6
- context "Xmlss::Style::Border" do
7
- subject { Xmlss::Style::Border.new }
10
+ should have_class_method :position
8
11
 
9
- should_have_class_method :position
10
12
  {
11
13
  :left => "Left",
12
14
  :top => "Top",
@@ -16,11 +18,12 @@ class Xmlss::Style::BorderTest < Test::Unit::TestCase
16
18
  :diagonal_right => "DiagonalRight"
17
19
  }.each do |position, value|
18
20
  should "provide the value for the '#{position}' position" do
19
- assert_equal value, Xmlss::Style::Border.position(position)
21
+ assert_equal value, Border.position(position)
20
22
  end
21
23
  end
22
24
 
23
- should_have_class_method :weight
25
+ should have_class_method :weight
26
+
24
27
  {
25
28
  :hairline => 0,
26
29
  :thin => 1,
@@ -28,11 +31,12 @@ class Xmlss::Style::BorderTest < Test::Unit::TestCase
28
31
  :thick => 3
29
32
  }.each do |weight, value|
30
33
  should "provide the value for the '#{weight}' weight" do
31
- assert_equal value, Xmlss::Style::Border.weight(weight)
34
+ assert_equal value, Border.weight(weight)
32
35
  end
33
36
  end
34
37
 
35
- should_have_class_method :line_style
38
+ should have_class_method :line_style
39
+
36
40
  {
37
41
  :none => "None",
38
42
  :continuous => "Continuous",
@@ -42,73 +46,63 @@ class Xmlss::Style::BorderTest < Test::Unit::TestCase
42
46
  :dash_dot_dot => "DashDotDot"
43
47
  }.each do |style, value|
44
48
  should "provide the value for the '#{style}' line_style" do
45
- assert_equal value, Xmlss::Style::Border.line_style(style)
49
+ assert_equal value, Border.line_style(style)
46
50
  end
47
51
  end
48
52
 
49
- should_have_accessors :color, :position, :weight, :line_style
53
+ should have_accessors :color, :position, :weight, :line_style
50
54
 
51
55
  should "set it's defaults" do
52
56
  assert_equal nil, subject.color
53
57
  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
58
+ assert_equal Border.weight(:thin), subject.weight
59
+ assert_equal Border.line_style(:continuous), subject.line_style
56
60
  end
57
61
 
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
62
+ should "set attrs at init" do
63
+ attrs = {
64
+ :color => '#FF0000',
65
+ :position => :top,
66
+ :weight => :thick,
67
+ :line_style => :dot
68
+ }
69
+ border = Border.new(attrs)
70
+
71
+ attrs.reject{|a, v| [:position, :weight, :line_style].include?(a)}.each do |a,v|
72
+ assert_equal v, border.send(a)
77
73
  end
74
+ assert_equal Border.position(:top), border.position
75
+ assert_equal Border.weight(:thick), border.weight
76
+ assert_equal Border.line_style(:dot), border.line_style
78
77
  end
79
78
 
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
79
+ should "set attrs by key" do
80
+ subject.position = :bottom
81
+ subject.weight = :medium
82
+ subject.line_style = :dash_dot
86
83
 
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
84
+ assert_equal Border.position(:bottom), subject.position
85
+ assert_equal Border.weight(:medium), subject.weight
86
+ assert_equal Border.line_style(:dash_dot), subject.line_style
92
87
  end
93
88
 
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
89
+ should "set attrs by value" do
90
+ subject.position = Border.position(:bottom)
91
+ subject.weight = Border.weight(:medium)
92
+ subject.line_style = Border.line_style(:dash_dot)
100
93
 
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
94
+ assert_equal Border.position(:bottom), subject.position
95
+ assert_equal Border.weight(:medium), subject.weight
96
+ assert_equal Border.line_style(:dash_dot), subject.line_style
106
97
  end
107
98
 
108
- context "for generating XML" do
109
- should_have_reader :xml
110
- should_build_node
111
- end
99
+ end
100
+
101
+ class BorderXmlTest < BorderTest
102
+ desc "for generating XML"
103
+ should have_reader :xml
104
+ should_build_node
112
105
 
113
106
  end
107
+
114
108
  end
@@ -1,12 +1,14 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require 'xmlss/style/font'
3
3
 
4
- class Xmlss::Style::FontTest < Test::Unit::TestCase
4
+ module Xmlss::Style
5
+ class FontTest < Assert::Context
6
+ desc "Xmlss::Style::Font"
7
+ before { @f = Font.new }
8
+ subject { @f }
5
9
 
6
- context "Xmlss::Style::Font" do
7
- subject { Xmlss::Style::Font.new }
10
+ should have_class_method :underline
8
11
 
9
- should_have_class_method :underline
10
12
  {
11
13
  :single => 'Single',
12
14
  :double => 'Double',
@@ -18,7 +20,8 @@ class Xmlss::Style::FontTest < Test::Unit::TestCase
18
20
  end
19
21
  end
20
22
 
21
- should_have_class_method :alignment
23
+ should have_class_method :alignment
24
+
22
25
  {
23
26
  :subscript => 'Subscript',
24
27
  :superscript => 'Superscript'
@@ -28,10 +31,10 @@ class Xmlss::Style::FontTest < Test::Unit::TestCase
28
31
  end
29
32
  end
30
33
 
31
- should_have_accessors :bold, :color, :italic, :size, :strike_through, :shadow
32
- should_have_accessors :underline, :alignment
33
- should_have_instance_methods :bold?, :italic?, :strike_through?, :shadow?
34
- should_have_reader :vertical_align
34
+ should have_accessors :bold, :color, :italic, :size, :strike_through, :shadow
35
+ should have_accessors :underline, :alignment
36
+ should have_instance_methods :bold?, :italic?, :strike_through?, :shadow?
37
+ should have_reader :vertical_align
35
38
 
36
39
  should "set it's defaults" do
37
40
  assert_equal false, subject.bold
@@ -44,59 +47,49 @@ class Xmlss::Style::FontTest < Test::Unit::TestCase
44
47
  assert_equal nil, subject.alignment
45
48
  end
46
49
 
47
- context "that sets attributes at init" do
48
- before do
49
- @attrs = {
50
- :bold => true,
51
- :color => '#FF0000',
52
- :italic => true,
53
- :size => 10,
54
- :strike_through => true,
55
- :underline => :single,
56
- :alignment => :superscript
57
- }
58
- @font = Xmlss::Style::Font.new(@attrs)
59
- end
60
- subject{ @font }
61
-
62
- should "should set them correctly" do
63
- @attrs.reject{|a, v| [:underline, :alignment].include?(a)}.each do |a,v|
64
- assert_equal v, subject.send(a)
65
- end
66
- assert_equal Xmlss::Style::Font.underline(:single), subject.underline
67
- assert_equal Xmlss::Style::Font.alignment(:superscript), subject.alignment
50
+ should "set attrs at init" do
51
+ attrs = {
52
+ :bold => true,
53
+ :color => '#FF0000',
54
+ :italic => true,
55
+ :size => 10,
56
+ :strike_through => true,
57
+ :underline => :single,
58
+ :alignment => :superscript
59
+ }
60
+ font = Font.new(attrs)
61
+
62
+ attrs.reject{|a, v| [:underline, :alignment].include?(a)}.each do |a,v|
63
+ assert_equal v, font.send(a)
68
64
  end
65
+ assert_equal Font.underline(:single), font.underline
66
+ assert_equal Font.alignment(:superscript), font.alignment
69
67
  end
70
68
 
71
- context "that sets underline and alignment by key" do
72
- before do
73
- subject.underline = :double
74
- subject.alignment = :subscript
75
- end
69
+ should "set attrs by key" do
70
+ subject.underline = :double
71
+ subject.alignment = :subscript
76
72
 
77
- should "should returm it by value" do
78
- assert_equal Xmlss::Style::Font.underline(:double), subject.underline
79
- assert_equal Xmlss::Style::Font.alignment(:subscript), subject.alignment
80
- end
73
+ assert_equal Font.underline(:double), subject.underline
74
+ assert_equal Font.alignment(:subscript), subject.alignment
81
75
  end
82
76
 
83
- context "that sets underline and alignment by value" do
84
- before do
85
- subject.underline = Xmlss::Style::Font.underline(:double)
86
- subject.alignment = Xmlss::Style::Font.alignment(:subscript)
87
- end
77
+ should "set attrs by value" do
78
+ subject.underline = Xmlss::Style::Font.underline(:double)
79
+ subject.alignment = Xmlss::Style::Font.alignment(:subscript)
88
80
 
89
- should "should returm it by value" do
90
- assert_equal Xmlss::Style::Font.underline(:double), subject.underline
91
- assert_equal Xmlss::Style::Font.alignment(:subscript), subject.alignment
92
- end
81
+ assert_equal Xmlss::Style::Font.underline(:double), subject.underline
82
+ assert_equal Xmlss::Style::Font.alignment(:subscript), subject.alignment
93
83
  end
94
84
 
95
- context "for generating XML" do
96
- should_have_reader :xml
97
- should_build_node
98
- should_build_no_attributes_by_default(Xmlss::Style::Font)
99
- end
85
+ end
100
86
 
87
+ class FontXmlTest < FontTest
88
+ desc "for generating XML"
89
+
90
+ should have_reader :xml
91
+ should_build_node
92
+ should_build_no_attributes_by_default(Xmlss::Style::Font)
101
93
  end
94
+
102
95
  end
@@ -1,12 +1,15 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require 'xmlss/style/interior'
3
3
 
4
- class Xmlss::Style::InteriorTest < Test::Unit::TestCase
4
+ module Xmlss::Style
5
5
 
6
- context "Xmlss::Style::Interior" do
7
- subject { Xmlss::Style::Interior.new }
6
+ class InteriorTest < Assert::Context
7
+ desc "Xmlss::Style::Interior"
8
+ before { @i = Interior.new }
9
+ subject { @i }
10
+
11
+ should have_class_method :pattern
8
12
 
9
- should_have_class_method :pattern
10
13
  {
11
14
  :none => "None",
12
15
  :solid => "Solid",
@@ -33,7 +36,7 @@ class Xmlss::Style::InteriorTest < Test::Unit::TestCase
33
36
  end
34
37
  end
35
38
 
36
- should_have_accessor :color, :pattern, :pattern_color
39
+ should have_accessor :color, :pattern, :pattern_color
37
40
 
38
41
  should "set it's defaults" do
39
42
  assert_equal nil, subject.color
@@ -41,47 +44,35 @@ class Xmlss::Style::InteriorTest < Test::Unit::TestCase
41
44
  assert_equal nil, subject.pattern_color
42
45
  end
43
46
 
44
- context "that sets attributes at init" do
45
- subject do
46
- Xmlss::Style::Interior.new({
47
- :color => "#000000",
48
- :pattern => :solid,
49
- :pattern_color => "#FF0000"
50
- })
51
- end
52
-
53
- should "should set them correctly" do
54
- assert_equal "#000000", subject.color
55
- assert_equal "Solid", subject.pattern
56
- assert_equal "#FF0000", subject.pattern_color
57
- end
47
+ should "set attributes at init" do
48
+ i = Interior.new({
49
+ :color => "#000000",
50
+ :pattern => :solid,
51
+ :pattern_color => "#FF0000"
52
+ })
53
+ assert_equal "#000000", i.color
54
+ assert_equal "Solid", i.pattern
55
+ assert_equal "#FF0000", i.pattern_color
58
56
  end
59
57
 
60
- context "that sets pattern by key" do
61
- before do
62
- subject.pattern = :solid
63
- end
64
-
65
- should "should returm them by value" do
66
- assert_equal "Solid", subject.pattern
67
- end
58
+ should "set attrs by key" do
59
+ subject.pattern = :solid
60
+ assert_equal "Solid", subject.pattern
68
61
  end
69
62
 
70
- context "that sets attributes by value" do
71
- before do
72
- subject.pattern = "Solid"
73
- end
74
-
75
- should "should returm them by value" do
76
- assert_equal "Solid", subject.pattern
77
- end
63
+ should "set attrs by value" do
64
+ subject.pattern = "Solid"
65
+ assert_equal "Solid", subject.pattern
78
66
  end
79
67
 
80
- context "for generating XML" do
81
- should_have_reader :xml
82
- should_build_node
83
- should_build_no_attributes_by_default(Xmlss::Style::Alignment)
84
- end
68
+ end
69
+
70
+ class InteriorXmlTest < InteriorTest
71
+ desc "for generating XML"
85
72
 
73
+ should have_reader :xml
74
+ should_build_node
75
+ should_build_no_attributes_by_default(Xmlss::Style::Alignment)
86
76
  end
77
+
87
78
  end
@@ -1,50 +1,39 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require 'xmlss/style/number_format'
3
3
 
4
- class Xmlss::Style::NumberFormatTest < Test::Unit::TestCase
4
+ module Xmlss::Style
5
+ class NumberFormatTest < Assert::Context
6
+ desc "Xmlss::Style::NumberFormat"
7
+ before { @nf = NumberFormat.new }
8
+ subject { @nf }
5
9
 
6
- context "Xmlss::Style::NumberFormat" do
7
- subject { Xmlss::Style::NumberFormat.new }
10
+ should have_accessor :format
8
11
 
9
- should_have_accessor :format
10
-
11
- context "that sets attributes at init" do
12
- subject do
13
- Xmlss::Style::NumberFormat.new({
14
- :format => "General"
15
- })
16
- end
17
-
18
- should "should set them correctly" do
19
- assert_equal "General", subject.format
20
- end
12
+ should "set attributes at init" do
13
+ nf = Xmlss::Style::NumberFormat.new({
14
+ :format => "General"
15
+ })
16
+ assert_equal "General", nf.format
21
17
  end
22
18
 
23
- context "that sets format by key" do
24
- before do
25
- subject.format = "@"
26
- end
27
-
28
- should "should returm it by value" do
29
- assert_equal "@", subject.format
30
- end
19
+ should "set format by key" do
20
+ subject.format = "@"
21
+ assert_equal "@", subject.format
31
22
  end
32
23
 
33
- context "that sets format by value" do
34
- before do
35
- subject.format = "True/False"
36
- end
37
-
38
- should "should returm it by value" do
39
- assert_equal "True/False", subject.format
40
- end
24
+ should "set format by value" do
25
+ subject.format = "True/False"
26
+ assert_equal "True/False", subject.format
41
27
  end
42
28
 
43
- context "for generating XML" do
44
- should_have_reader :xml
45
- should_build_node
46
- should_build_no_attributes_by_default(Xmlss::Style::Alignment)
47
- end
29
+ end
48
30
 
31
+ class NumberFormatXmlTest < NumberFormatTest
32
+ desc "for generating XML"
33
+
34
+ should have_reader :xml
35
+ should_build_node
36
+ should_build_no_attributes_by_default(Xmlss::Style::Alignment)
49
37
  end
38
+
50
39
  end