test/workbook_test.rb in osheet-0.2.0 vs test/workbook_test.rb in osheet-0.3.0
- old
+ new
@@ -56,9 +56,28 @@
worksheets = subject.send(:instance_variable_get, "@worksheets")
assert_equal 1, worksheets.size
assert_kind_of Worksheet, worksheets.first
end
+ should "not allow multiple worksheets with the same name" do
+ assert_raises ArgumentError do
+ Workbook.new {
+ title "should fail"
+
+ worksheet { name "awesome" }
+ worksheet { name "awesome" }
+ }
+ end
+ assert_nothing_raised do
+ Workbook.new {
+ title "should not fail"
+
+ worksheet { name "awesome" }
+ worksheet { name "awesome1" }
+ }
+ end
+ end
+
should "know it's attribute(s)" do
[:title].each do |a|
assert subject.attributes.has_key?(a)
end
assert_equal "The Poo", subject.attributes[:title]