osheet 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/.gitignore +5 -3
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +13 -37
  4. data/Rakefile +3 -3
  5. data/lib/osheet/format/numeric.rb +0 -2
  6. data/lib/osheet/instance.rb +1 -3
  7. data/lib/osheet/version.rb +2 -2
  8. data/osheet.gemspec +3 -9
  9. data/test/cell_test.rb +96 -104
  10. data/test/column_test.rb +90 -97
  11. data/test/format/accounting_test.rb +115 -128
  12. data/test/format/currency_test.rb +115 -128
  13. data/test/format/custom_test.rb +13 -13
  14. data/test/format/datetime_test.rb +13 -13
  15. data/test/format/fraction_test.rb +63 -63
  16. data/test/format/general_test.rb +11 -11
  17. data/test/format/number_test.rb +67 -69
  18. data/test/format/percentage_test.rb +89 -91
  19. data/test/format/scientific_test.rb +89 -91
  20. data/test/format/special_test.rb +35 -35
  21. data/test/format/text_test.rb +9 -9
  22. data/test/format_test.rb +24 -24
  23. data/test/helper.rb +42 -47
  24. data/test/irb.rb +9 -0
  25. data/test/mixin_test.rb +55 -59
  26. data/test/osheet_test.rb +7 -10
  27. data/test/partial_set_test.rb +41 -61
  28. data/test/partial_test.rb +44 -46
  29. data/test/row_test.rb +92 -99
  30. data/test/style_set_test.rb +34 -37
  31. data/test/style_test.rb +72 -97
  32. data/test/template_set_test.rb +52 -73
  33. data/test/template_test.rb +31 -49
  34. data/test/workbook_test.rb +186 -199
  35. data/test/worksheet_test.rb +99 -103
  36. data/test/xmlss_writer/base_test.rb +72 -73
  37. data/test/xmlss_writer/elements_test.rb +141 -140
  38. data/test/xmlss_writer/styles_test.rb +197 -208
  39. metadata +27 -247
  40. data/.bundle/config +0 -2
  41. data/test/app_helper.rb +0 -66
  42. data/test/env.rb +0 -10
  43. data/test/rails/three/.gitignore +0 -4
  44. data/test/rails/three/Gemfile +0 -5
  45. data/test/rails/three/Gemfile.lock +0 -88
  46. data/test/rails/three/app/controllers/application_controller.rb +0 -3
  47. data/test/rails/three/app/controllers/things_controller.rb +0 -10
  48. data/test/rails/three/app/helpers/application_helper.rb +0 -2
  49. data/test/rails/three/app/views/layouts/application.html.erb +0 -14
  50. data/test/rails/three/app/views/things/index.xls.osheet +0 -13
  51. data/test/rails/three/config/application.rb +0 -42
  52. data/test/rails/three/config/boot.rb +0 -13
  53. data/test/rails/three/config/database.yml +0 -22
  54. data/test/rails/three/config/environment.rb +0 -5
  55. data/test/rails/three/config/environments/development.rb +0 -26
  56. data/test/rails/three/config/environments/production.rb +0 -49
  57. data/test/rails/three/config/environments/test.rb +0 -35
  58. data/test/rails/three/config/initializers/app.rb +0 -0
  59. data/test/rails/three/config/initializers/backtrace_silencers.rb +0 -7
  60. data/test/rails/three/config/initializers/inflections.rb +0 -10
  61. data/test/rails/three/config/initializers/mime_types.rb +0 -5
  62. data/test/rails/three/config/initializers/secret_token.rb +0 -7
  63. data/test/rails/three/config/initializers/session_store.rb +0 -8
  64. data/test/rails/three/config/locales/en.yml +0 -5
  65. data/test/rails/three/config/routes.rb +0 -3
  66. data/test/rails/three/config.ru +0 -4
  67. data/test/rails/three/db/seeds.rb +0 -7
  68. data/test/rails/three/doc/README_FOR_APP +0 -2
  69. data/test/rails/three/lib/tasks/.gitkeep +0 -0
  70. data/test/rails/three/script/rails +0 -6
  71. data/test/rails/two/.bundle/config +0 -2
  72. data/test/rails/two/Booting +0 -0
  73. data/test/rails/two/Gemfile +0 -5
  74. data/test/rails/two/Gemfile.lock +0 -45
  75. data/test/rails/two/Rails +0 -0
  76. data/test/rails/two/app/controllers/application_controller.rb +0 -20
  77. data/test/rails/two/app/controllers/things_controller.rb +0 -10
  78. data/test/rails/two/app/helpers/application_helper.rb +0 -3
  79. data/test/rails/two/app/views/things/index.xls.osheet +0 -15
  80. data/test/rails/two/config/boot.rb +0 -128
  81. data/test/rails/two/config/database.yml +0 -22
  82. data/test/rails/two/config/environment.rb +0 -41
  83. data/test/rails/two/config/environments/development.rb +0 -17
  84. data/test/rails/two/config/environments/production.rb +0 -28
  85. data/test/rails/two/config/environments/test.rb +0 -28
  86. data/test/rails/two/config/initializers/app.rb +0 -2
  87. data/test/rails/two/config/initializers/backtrace_silencers.rb +0 -7
  88. data/test/rails/two/config/initializers/cookie_verification_secret.rb +0 -7
  89. data/test/rails/two/config/initializers/inflections.rb +0 -10
  90. data/test/rails/two/config/initializers/mime_types.rb +0 -5
  91. data/test/rails/two/config/initializers/new_rails_defaults.rb +0 -21
  92. data/test/rails/two/config/initializers/session_store.rb +0 -15
  93. data/test/rails/two/config/locales/en.yml +0 -5
  94. data/test/rails/two/config/routes.rb +0 -3
  95. data/test/rails/two/db/development.sqlite3 +0 -0
  96. data/test/rails/two/db/seeds.rb +0 -7
  97. data/test/rails/two/script/about +0 -4
  98. data/test/rails/two/script/console +0 -3
  99. data/test/rails/two/script/dbconsole +0 -3
  100. data/test/rails/two/script/destroy +0 -3
  101. data/test/rails/two/script/generate +0 -3
  102. data/test/rails/two/script/performance/benchmarker +0 -3
  103. data/test/rails/two/script/performance/profiler +0 -3
  104. data/test/rails/two/script/plugin +0 -3
  105. data/test/rails/two/script/runner +0 -3
  106. data/test/rails/two/script/server +0 -3
  107. data/test/rails/two/tmp/pids/server.pid +0 -1
  108. data/test/rails_test.rb +0 -38
  109. data/test/sinatra/app.rb +0 -16
  110. data/test/sinatra/views/index.osheet +0 -13
  111. data/test/sinatra_test.rb +0 -19
data/test/osheet_test.rb CHANGED
@@ -1,16 +1,13 @@
1
- require "test/helper"
1
+ require "assert"
2
2
 
3
- class OsheetTest < Test::Unit::TestCase
3
+ class OsheetTest < Assert::Context
4
+ desc "Osheet"
5
+ subject {::Osheet}
4
6
 
5
- context "Osheet" do
6
- subject {::Osheet}
7
-
8
- should_have_instance_method :register
9
-
10
- should "use provide a default mime type" do
11
- assert_equal "application/vnd.ms-excel", Osheet::MIME_TYPE
12
- end
7
+ should have_instance_method :register
13
8
 
9
+ should "use provide a default mime type" do
10
+ assert_equal "application/vnd.ms-excel", Osheet::MIME_TYPE
14
11
  end
15
12
 
16
13
  end
@@ -1,84 +1,64 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require "osheet/partial_set"
3
3
 
4
4
  module Osheet
5
5
 
6
- class PartialSetTest < Test::Unit::TestCase
7
- context "Osheet::PartialSet" do
8
- subject { PartialSet.new }
9
-
10
- should "be a Hash" do
11
- assert_kind_of ::Hash, subject
12
- end
13
-
14
- should_have_instance_method :<<
15
- should_have_reader :get
16
-
17
- should "verify set objs are partials" do
18
- assert_raises ArgumentError do
19
- subject.send(:verify, {})
20
- end
21
- assert_nothing_raised do
22
- subject.send(:verify, Partial.new(:poo) {})
23
- end
24
- end
6
+ class PartialSetTest < Assert::Context
7
+ desc "Osheet::PartialSet"
8
+ before { @ps = PartialSet.new }
9
+ subject { @ps }
25
10
 
11
+ should "be a Hash" do
12
+ assert_kind_of ::Hash, subject
26
13
  end
27
- end
28
14
 
29
- class PartialSetKeyTest < Test::Unit::TestCase
30
- context "A partial set" do
31
- subject { PartialSet.new }
15
+ should have_instance_method :<<
16
+ should have_reader :get
32
17
 
33
- should "key using name values" do
34
- assert_equal 'poo', subject.send(:key, :poo)
18
+ should "verify set objs are partials" do
19
+ assert_raises ArgumentError do
20
+ subject.send(:verify, {})
35
21
  end
36
-
37
- should "key on partial objs" do
38
- assert_equal 'poo', subject.send(:partial_key, Partial.new(:poo) {})
22
+ assert_nothing_raised do
23
+ subject.send(:verify, Partial.new(:poo) {})
39
24
  end
25
+ end
40
26
 
41
- should "init the key in the set when verifying" do
42
- key = subject.send(:verify, Partial.new(:thing) {})
43
- assert_equal 'thing', key
44
- assert_equal({'thing' => nil}, subject)
45
- end
27
+ should "key using name values" do
28
+ assert_equal 'poo', subject.send(:key, :poo)
29
+ end
46
30
 
31
+ should "key on partial objs" do
32
+ assert_equal 'poo', subject.send(:partial_key, Partial.new(:poo) {})
47
33
  end
48
- end
49
34
 
50
- class PartialSetPushTest < Test::Unit::TestCase
51
- context "A partial set" do
52
- subject { PartialSet.new }
53
- should "push partials onto the set" do
54
- assert_nothing_raised do
55
- subject << Partial.new(:poo) {}
56
- subject << Partial.new(:not_poo) {}
57
- subject << Partial.new(:awesome) {}
58
- subject << Partial.new(:poo) {}
59
- end
35
+ should "init the key in the set when verifying" do
36
+ key = subject.send(:verify, Partial.new(:thing) {})
37
+ assert_equal 'thing', key
38
+ assert_equal({'thing' => nil}, subject)
39
+ end
60
40
 
61
- assert_equal 3, subject.keys.size
62
- assert subject["poo"]
63
- assert_kind_of Partial, subject["poo"]
41
+ should "push partials onto the set" do
42
+ assert_nothing_raised do
43
+ subject << Partial.new(:poo) {}
44
+ subject << Partial.new(:not_poo) {}
45
+ subject << Partial.new(:awesome) {}
46
+ subject << Partial.new(:poo) {}
64
47
  end
65
48
 
49
+ assert_equal 3, subject.keys.size
50
+ assert subject["poo"]
51
+ assert_kind_of Partial, subject["poo"]
66
52
  end
67
- end
68
-
69
- class PartialSetLookupTest < Test::Unit::TestCase
70
- context "A partial set" do
71
- subject { PartialSet.new }
72
-
73
- should "lookup a partial by name" do
74
- p = Partial.new(:poo) {}
75
- subject << p
76
- assert_equal p, subject.get(:poo)
77
- assert_equal p, subject.get('poo')
78
- assert_equal nil, subject.get(:ugh)
79
- end
80
53
 
54
+ should "lookup a partial by name" do
55
+ p = Partial.new(:poo) {}
56
+ subject << p
57
+ assert_equal p, subject.get(:poo)
58
+ assert_equal p, subject.get('poo')
59
+ assert_equal nil, subject.get(:ugh)
81
60
  end
61
+
82
62
  end
83
63
 
84
64
  end
data/test/partial_test.rb CHANGED
@@ -1,66 +1,64 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require "osheet/partial"
3
3
 
4
4
  module Osheet
5
- class PartialTest < Test::Unit::TestCase
5
+ class PartialTest < Assert::Context
6
+ desc "Osheet::Partial"
7
+ before { @p = Partial.new(:thing) {} }
8
+ subject { @p }
6
9
 
7
- context "Osheet::Partial" do
8
- subject do
9
- Partial.new(:thing) {}
10
- end
11
-
12
- should_have_accessor :name
13
-
14
- should "be a Proc" do
15
- assert_kind_of ::Proc, subject
16
- end
10
+ should have_accessor :name
17
11
 
18
- should "convert the name arg to a string and store off" do
19
- assert_equal 'thing', subject.name
20
- end
12
+ should "be a Proc" do
13
+ assert_kind_of ::Proc, subject
14
+ end
21
15
 
16
+ should "convert the name arg to a string and store off" do
17
+ assert_equal 'thing', subject.name
22
18
  end
19
+
23
20
  end
24
21
 
25
- class PartialNameTest < Test::Unit::TestCase
26
- context "A named partial" do
27
- should "verify the name argument" do
28
- assert_raises ArgumentError do
29
- Partial.new([]) {}
30
- end
31
- assert_raises ArgumentError do
32
- Partial.new(1) {}
33
- end
34
- assert_nothing_raised do
35
- Partial.new(:poo) {}
36
- end
37
- assert_nothing_raised do
38
- Partial.new('poo') {}
39
- end
40
- end
22
+ class PartialNameTest < Assert::Context
23
+ desc "A named partial"
41
24
 
25
+ should "verify the name argument" do
26
+ assert_raises ArgumentError do
27
+ Partial.new([]) {}
28
+ end
29
+ assert_raises ArgumentError do
30
+ Partial.new(1) {}
31
+ end
32
+ assert_nothing_raised do
33
+ Partial.new(:poo) {}
34
+ end
35
+ assert_nothing_raised do
36
+ Partial.new('poo') {}
37
+ end
42
38
  end
39
+
43
40
  end
44
41
 
45
- class PartialBindingTest < Test::Unit::TestCase
46
- context "a partial defined w/ a block" do
47
- should "access instance vars from that block's binding" do
48
- @test = 'test thing'
49
- @workbook = Workbook.new {
50
- partial(:stuff) {
51
- worksheet(:thing) { name @test }
52
- }
42
+ class PartialBindingTest < Assert::Context
43
+ desc "a partial defined w/ a block"
53
44
 
54
- add(:stuff)
45
+ should "access instance vars from that block's binding" do
46
+ @test = 'test thing'
47
+ @workbook = Workbook.new {
48
+ partial(:stuff) {
49
+ worksheet(:thing) { name @test }
55
50
  }
56
51
 
57
- assert !@workbook.worksheets.first.send(:instance_variable_get, "@test").nil?
58
- assert_equal @test, @workbook.worksheets.first.send(:instance_variable_get, "@test")
59
- assert_equal @test.object_id, @workbook.worksheets.first.send(:instance_variable_get, "@test").object_id
60
- assert_equal @test, @workbook.worksheets.first.attributes[:name]
61
- assert_equal @test.object_id, @workbook.worksheets.first.attributes[:name].object_id
62
- end
52
+ add(:stuff)
53
+ }
54
+
55
+ assert !@workbook.worksheets.first.send(:instance_variable_get, "@test").nil?
56
+ assert_equal @test, @workbook.worksheets.first.send(:instance_variable_get, "@test")
57
+ assert_equal @test.object_id, @workbook.worksheets.first.send(:instance_variable_get, "@test").object_id
58
+ assert_equal @test, @workbook.worksheets.first.attributes[:name]
59
+ assert_equal @test.object_id, @workbook.worksheets.first.attributes[:name].object_id
63
60
  end
61
+
64
62
  end
65
63
 
66
64
  end
data/test/row_test.rb CHANGED
@@ -1,131 +1,124 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require 'osheet/row'
3
3
 
4
4
  module Osheet
5
5
 
6
- class RowTest < Test::Unit::TestCase
7
- context "Osheet::Row" do
8
- subject { Row.new }
6
+ class RowTest < Assert::Context
7
+ desc "Osheet::Row"
8
+ before { @rw = Row.new }
9
+ subject { @rw }
9
10
 
10
- should_be_a_styled_element(Row)
11
- should_be_a_worksheet_element(Row)
12
- should_be_a_workbook_element(Row)
11
+ should_be_a_styled_element(Row)
12
+ should_be_a_worksheet_element(Row)
13
+ should_be_a_workbook_element(Row)
13
14
 
14
- should_have_instance_method :height
15
- should_have_instance_methods :autofit, :autofit?
16
- should_have_instance_methods :hidden, :hidden?
17
- should_have_instance_method :meta
15
+ should have_instance_method :height
16
+ should have_instance_methods :autofit, :autofit?
17
+ should have_instance_methods :hidden, :hidden?
18
+ should have_instance_method :meta
18
19
 
19
- should_hm(Row, :cells, Cell)
20
+ should_hm(Row, :cells, Cell)
20
21
 
21
- should "set it's defaults" do
22
- assert_equal nil, subject.send(:get_ivar, "height")
23
- assert_equal false, subject.send(:get_ivar, "autofit")
24
- assert !subject.autofit?
25
- assert_equal false, subject.send(:get_ivar, "hidden")
26
- assert !subject.hidden?
22
+ should "set it's defaults" do
23
+ assert_equal nil, subject.send(:get_ivar, "height")
24
+ assert_equal false, subject.send(:get_ivar, "autofit")
25
+ assert !subject.autofit?
26
+ assert_equal false, subject.send(:get_ivar, "hidden")
27
+ assert !subject.hidden?
27
28
 
28
- assert_equal [], subject.cells
29
- assert_equal nil, subject.meta
30
- end
29
+ assert_equal [], subject.cells
30
+ assert_equal nil, subject.meta
31
+ end
31
32
 
33
+ should "set it's height" do
34
+ subject.height(false)
35
+ assert_equal false, subject.height
36
+ subject.height(180)
37
+ assert_equal 180, subject.height
38
+ subject.height(nil)
39
+ assert_equal 180, subject.height
32
40
  end
33
- end
34
41
 
35
- class RowAttributeTest < Test::Unit::TestCase
36
- context "a row that has attributes" do
37
- subject do
38
- Row.new do
39
- style_class "poo"
40
- height 100
41
- autofit true
42
- hidden true
43
- meta(
44
- {}
45
- )
46
- end
47
- end
42
+ should "cast autofit and hidden to bool" do
43
+ rw = Row.new { autofit :true; hidden 'false'}
44
+ assert_kind_of ::TrueClass, rw.send(:get_ivar, "autofit")
45
+ assert_kind_of ::TrueClass, rw.send(:get_ivar, "hidden")
46
+ end
48
47
 
49
- should "should set them correctly" do
50
- assert_equal 100, subject.send(:get_ivar, "height")
51
- assert_equal true, subject.send(:get_ivar, "autofit")
52
- assert subject.autofit?
53
- assert_equal true, subject.send(:get_ivar, "hidden")
54
- assert subject.hidden?
55
- assert_equal({}, subject.meta)
56
- end
48
+ end
57
49
 
58
- should "know it's attribute(s)" do
59
- [:style_class, :height, :autofit, :hidden].each do |a|
60
- assert subject.attributes.has_key?(a)
61
- end
62
- assert_equal 'poo', subject.attributes[:style_class]
63
- assert_equal 100, subject.attributes[:height]
64
- assert_equal true, subject.attributes[:autofit]
65
- assert_equal true, subject.attributes[:hidden]
50
+ class RowAttributeTest < RowTest
51
+ desc "a row that has attributes"
52
+ before do
53
+ @rw = Row.new do
54
+ style_class "poo"
55
+ height 100
56
+ autofit true
57
+ hidden true
58
+ meta(
59
+ {}
60
+ )
66
61
  end
67
-
68
62
  end
69
- end
70
63
 
71
- class RowDataTest < Test::Unit::TestCase
72
- context "A row" do
73
- subject { Row.new }
74
-
75
- should "set it's height" do
76
- subject.height(false)
77
- assert_equal false, subject.height
78
- subject.height(180)
79
- assert_equal 180, subject.height
80
- subject.height(nil)
81
- assert_equal 180, subject.height
82
- end
64
+ should "should set them correctly" do
65
+ assert_equal 100, subject.send(:get_ivar, "height")
66
+ assert_equal true, subject.send(:get_ivar, "autofit")
67
+ assert subject.autofit?
68
+ assert_equal true, subject.send(:get_ivar, "hidden")
69
+ assert subject.hidden?
70
+ assert_equal({}, subject.meta)
71
+ end
83
72
 
84
- should "cast autofit and hidden to bool" do
85
- rw = Row.new { autofit :true; hidden 'false'}
86
- assert_kind_of ::TrueClass, rw.send(:get_ivar, "autofit")
87
- assert_kind_of ::TrueClass, rw.send(:get_ivar, "hidden")
73
+ should "know it's attribute(s)" do
74
+ [:style_class, :height, :autofit, :hidden].each do |a|
75
+ assert subject.attributes.has_key?(a)
88
76
  end
89
-
77
+ assert_equal 'poo', subject.attributes[:style_class]
78
+ assert_equal 100, subject.attributes[:height]
79
+ assert_equal true, subject.attributes[:autofit]
80
+ assert_equal true, subject.attributes[:hidden]
90
81
  end
82
+
91
83
  end
92
84
 
93
- class RowPartialTest < Test::Unit::TestCase
94
- context "A workbook that defines column partials" do
95
- subject do
96
- Workbook.new {
97
- partial(:row_stuff) {
98
- height 200
99
- meta 'awesome'
100
- }
101
-
102
- worksheet { row {
103
- add :row_stuff
104
- } }
85
+ class RowPartialTest < Assert::Context
86
+ desc "A workbook that defines column partials"
87
+ before do
88
+ @wkbk = Workbook.new {
89
+ partial(:row_stuff) {
90
+ height 200
91
+ meta 'awesome'
105
92
  }
106
- end
107
93
 
108
- should "add it's partials to it's markup" do
109
- assert_equal 200, subject.worksheets.first.rows.first.height
110
- assert_equal 'awesome', subject.worksheets.first.rows.first.meta
111
- end
94
+ worksheet { row {
95
+ add :row_stuff
96
+ } }
97
+ }
98
+ end
99
+ subject { @wkbk }
112
100
 
101
+ should "add it's partials to it's markup" do
102
+ assert_equal 200, subject.worksheets.first.rows.first.height
103
+ assert_equal 'awesome', subject.worksheets.first.rows.first.meta
113
104
  end
105
+
114
106
  end
115
107
 
116
- class RowBindingTest < Test::Unit::TestCase
117
- context "a row defined w/ a block" do
118
- should "access instance vars from that block's binding" do
119
- @test = 50
120
- @row = Row.new { height @test }
121
-
122
- assert !@row.send(:instance_variable_get, "@test").nil?
123
- assert_equal @test, @row.send(:instance_variable_get, "@test")
124
- assert_equal @test.object_id, @row.send(:instance_variable_get, "@test").object_id
125
- assert_equal @test, @row.attributes[:height]
126
- assert_equal @test.object_id, @row.attributes[:height].object_id
127
- end
108
+ class RowBindingTest < Assert::Context
109
+ desc "a row defined w/ a block"
110
+
111
+ should "access instance vars from that block's binding" do
112
+ @test = 50
113
+ @row = Row.new { height @test }
114
+
115
+ assert !@row.send(:instance_variable_get, "@test").nil?
116
+ assert_equal @test, @row.send(:instance_variable_get, "@test")
117
+ assert_equal @test.object_id, @row.send(:instance_variable_get, "@test").object_id
118
+ assert_equal @test, @row.attributes[:height]
119
+ assert_equal @test.object_id, @row.attributes[:height].object_id
128
120
  end
121
+
129
122
  end
130
123
 
131
124
  end
@@ -1,50 +1,47 @@
1
- require "test/helper"
1
+ require "assert"
2
2
  require "osheet/style_set"
3
3
 
4
4
  module Osheet
5
- class StyleSetTest < Test::Unit::TestCase
5
+ class StyleSetTest < Assert::Context
6
+ desc "Osheet::StyleSet"
7
+ before { @set = StyleSet.new }
8
+ subject { @set }
6
9
 
7
- context "Osheet::StyleSet" do
8
- subject { StyleSet.new }
9
-
10
- should "be an Array" do
11
- assert_kind_of ::Array, subject
12
- end
10
+ should "be an Array" do
11
+ assert_kind_of ::Array, subject
12
+ end
13
13
 
14
- should_have_reader :for
14
+ should have_reader :for
15
15
 
16
- should "verify Template objs" do
17
- assert_raises ArgumentError do
18
- subject.send(:verify, {})
19
- end
20
- assert_nothing_raised do
21
- subject.send(:verify, Style.new('.awesome') {})
22
- end
16
+ should "verify Template objs" do
17
+ assert_raises ArgumentError do
18
+ subject.send(:verify, {})
23
19
  end
24
-
25
- should "be able to lookup styles by class" do
26
- subject << (a = Style.new('.awesome') {})
27
- subject << (at = Style.new('.awesome.thing') {})
28
- subject << (b = Style.new('.boring') {})
29
- subject << (bt = Style.new('.boring.thing') {})
30
- subject << (a_b = Style.new('.awesome', '.boring') {})
31
- subject << (t = Style.new('.thing') {})
32
- subject << (s = Style.new('.stupid') {})
33
-
34
- { 'awesome' => [a, a_b],
35
- 'boring' => [b, a_b],
36
- 'thing' => [t],
37
- 'awesome thing' => [a, at, a_b, t],
38
- 'thing awesome' => [a, at, a_b, t],
39
- 'other' => []
40
- }.each do |style_class, styles_set|
41
- if style_class == 'awesome'
42
- assert_equal styles_set, subject.for(style_class)
43
- end
44
- end
20
+ assert_nothing_raised do
21
+ subject.send(:verify, Style.new('.awesome') {})
45
22
  end
23
+ end
46
24
 
25
+ should "be able to lookup styles by class" do
26
+ subject << (a = Style.new('.awesome') {})
27
+ subject << (at = Style.new('.awesome.thing') {})
28
+ subject << (b = Style.new('.boring') {})
29
+ subject << (bt = Style.new('.boring.thing') {})
30
+ subject << (a_b = Style.new('.awesome', '.boring') {})
31
+ subject << (t = Style.new('.thing') {})
32
+ subject << (s = Style.new('.stupid') {})
33
+
34
+ { 'awesome' => [a, a_b],
35
+ 'boring' => [b, a_b],
36
+ 'thing' => [t],
37
+ 'awesome thing' => [a, at, a_b, t],
38
+ 'thing awesome' => [a, at, a_b, t],
39
+ 'other' => []
40
+ }.each do |style_class, styles_set|
41
+ assert_equal styles_set, subject.for(style_class)
42
+ end
47
43
  end
48
44
 
49
45
  end
46
+
50
47
  end