robust_excel_ole 0.6 → 0.6.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.
- data/Changelog +12 -0
- data/README.rdoc +5 -3
- data/README_detail.rdoc +1 -1
- data/examples/edit_sheets/example_adding_sheets.rb +1 -1
- data/examples/edit_sheets/example_expanding.rb +1 -1
- data/examples/open_save_close/example_control_to_excel.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +1 -1
- data/examples/open_save_close/example_if_obstructed_forget.rb +1 -1
- data/examples/open_save_close/example_if_unsaved_accept.rb +2 -2
- data/examples/open_save_close/example_read_only.rb +1 -1
- data/examples/open_save_close/example_simple.rb +1 -1
- data/lib/robust_excel_ole/book.rb +89 -111
- data/lib/robust_excel_ole/excel.rb +49 -50
- data/lib/robust_excel_ole/general.rb +3 -3
- data/lib/robust_excel_ole/reo_common.rb +78 -1
- data/lib/robust_excel_ole/sheet.rb +16 -23
- data/lib/robust_excel_ole/version.rb +1 -1
- data/spec/book_spec.rb +7 -7
- data/spec/book_specs/book_close_spec.rb +24 -5
- data/spec/book_specs/book_misc_spec.rb +16 -7
- data/spec/book_specs/book_open_spec.rb +15 -20
- data/spec/book_specs/book_save_spec.rb +21 -21
- data/spec/book_specs/book_sheet_spec.rb +3 -3
- data/spec/book_specs/book_unobtr_spec.rb +1 -1
- data/spec/data/book_with_blank.xls +0 -0
- data/spec/data/different_workbook.xls +0 -0
- data/spec/data/refed_wb.xls +0 -0
- data/spec/data/reference_workbook.xls +0 -0
- data/spec/data/referencing_wb.xls +0 -0
- data/spec/data/workbook.xls +0 -0
- data/spec/excel_spec.rb +87 -125
- data/spec/general_spec.rb +2 -2
- data/spec/reo_common_spec.rb +1 -1
- data/spec/sheet_spec.rb +13 -17
- metadata +7 -3
@@ -49,6 +49,15 @@ describe Book do
|
|
49
49
|
|
50
50
|
describe "with visible" do
|
51
51
|
|
52
|
+
it "should adapt its default value at the visible value of the Excel" do
|
53
|
+
excel1 = Excel.create
|
54
|
+
excel1.Visible = true
|
55
|
+
book1 = Book.open(@simple_file)
|
56
|
+
excel1.Visible.should be_true
|
57
|
+
excel1.visible.should be_true
|
58
|
+
book1.visible.should be_true
|
59
|
+
end
|
60
|
+
|
52
61
|
it "should preserve :visible if it is not set" do
|
53
62
|
book1 = Book.open(@simple_file)
|
54
63
|
book1.excel.Visible.should be_false
|
@@ -289,7 +298,7 @@ describe Book do
|
|
289
298
|
|
290
299
|
it "should report that workbook is not alive" do
|
291
300
|
@book.close
|
292
|
-
expect{ @book.Nonexisting_method }.to raise_error(
|
301
|
+
expect{ @book.Nonexisting_method }.to raise_error(ObjectNotAlive, "method missing: workbook not alive")
|
293
302
|
end
|
294
303
|
end
|
295
304
|
|
@@ -370,22 +379,22 @@ describe Book do
|
|
370
379
|
it "should raise an error if name not defined" do
|
371
380
|
expect {
|
372
381
|
@book1.nameval("foo")
|
373
|
-
}.to raise_error(
|
382
|
+
}.to raise_error(NameNotFound, /name "foo" not in "another_workbook.xls"/)
|
374
383
|
expect {
|
375
384
|
@book1.set_nameval("foo","bar")
|
376
|
-
}.to raise_error(
|
385
|
+
}.to raise_error(NameNotFound, /name "foo" not in "another_workbook.xls"/)
|
377
386
|
expect {
|
378
387
|
@book1["foo"] = "bar"
|
379
|
-
}.to raise_error(
|
388
|
+
}.to raise_error(NameNotFound, /name "foo" not in "another_workbook.xls"/)
|
380
389
|
end
|
381
390
|
|
382
391
|
it "should raise an error if name was defined but contents is calcuated" do
|
383
392
|
expect {
|
384
393
|
@book1.set_nameval("named_formula","bar")
|
385
|
-
}.to raise_error(
|
394
|
+
}.to raise_error(RangeNotEvaluatable, /cannot assign value to range named "named_formula" in "another_workbook.xls"/)
|
386
395
|
expect {
|
387
396
|
@book1["named_formula"] = "bar"
|
388
|
-
}.to raise_error(
|
397
|
+
}.to raise_error(RangeNotEvaluatable, /cannot assign value to range named "named_formula" in "another_workbook.xls"/)
|
389
398
|
end
|
390
399
|
|
391
400
|
# Excel Bug: for local names without uqifier: takes the first sheet as default even if another sheet is activated
|
@@ -415,7 +424,7 @@ describe Book do
|
|
415
424
|
@book1.nameval("five").should == [[1,2],[3,4]]
|
416
425
|
expect {
|
417
426
|
@book1.rename_range("four","five")
|
418
|
-
}.to raise_error(
|
427
|
+
}.to raise_error(NameNotFound, /name "four" not in "another_workbook.xls"/)
|
419
428
|
end
|
420
429
|
end
|
421
430
|
|
@@ -335,7 +335,7 @@ describe Book do
|
|
335
335
|
it "should raise an error if no Excel or Book is given" do
|
336
336
|
expect{
|
337
337
|
Book.open(@simple_file1, :force_excel => :b)
|
338
|
-
}.to raise_error(
|
338
|
+
}.to raise_error(TypeErrorREO, "given object is neither an Excel, a Workbook, nor a Win32ole")
|
339
339
|
end
|
340
340
|
|
341
341
|
it "should do force_excel even if both force_ and default_excel is given" do
|
@@ -564,7 +564,7 @@ describe Book do
|
|
564
564
|
it "should raise an error if no Excel or Book is given" do
|
565
565
|
expect{
|
566
566
|
Book.open(@different_file, :default_excel => :a)
|
567
|
-
}.to raise_error(
|
567
|
+
}.to raise_error(TypeErrorREO, "given object is neither an Excel, a Workbook, nor a Win32ole")
|
568
568
|
end
|
569
569
|
|
570
570
|
end
|
@@ -807,7 +807,7 @@ describe Book do
|
|
807
807
|
it "should raise an error, if :if_unsaved is :raise" do
|
808
808
|
expect {
|
809
809
|
@new_book = Book.open(@simple_file1, :if_unsaved => :raise)
|
810
|
-
}.to raise_error(
|
810
|
+
}.to raise_error(WorkbookNotSaved, /workbook is already open but not saved: "workbook.xls"/)
|
811
811
|
end
|
812
812
|
|
813
813
|
it "should let the book open, if :if_unsaved is :accept" do
|
@@ -853,7 +853,7 @@ describe Book do
|
|
853
853
|
@key_sender.puts "{right}{enter}"
|
854
854
|
expect{
|
855
855
|
Book.open(@simple_file1, :if_unsaved => :alert)
|
856
|
-
}.to raise_error(
|
856
|
+
}.to raise_error(WorkbookError, "open: user canceled or open error")
|
857
857
|
@book.should be_alive
|
858
858
|
end
|
859
859
|
end
|
@@ -885,7 +885,7 @@ describe Book do
|
|
885
885
|
@key_sender.puts "{right}{enter}"
|
886
886
|
expect{
|
887
887
|
Book.open(@simple_file1, :if_unsaved => :excel)
|
888
|
-
}.to raise_error(
|
888
|
+
}.to raise_error(WorkbookError, "open: user canceled or open error")
|
889
889
|
@book.should be_alive
|
890
890
|
end
|
891
891
|
end
|
@@ -902,13 +902,13 @@ describe Book do
|
|
902
902
|
it "should raise an error, if :if_unsaved is default" do
|
903
903
|
expect {
|
904
904
|
@new_book = Book.open(@simple_file1, :if_unsaved => :raise)
|
905
|
-
}.to raise_error(
|
905
|
+
}.to raise_error(WorkbookNotSaved, /workbook is already open but not saved: "workbook.xls"/)
|
906
906
|
end
|
907
907
|
|
908
908
|
it "should raise an error, if :if_unsaved is invalid option" do
|
909
909
|
expect {
|
910
910
|
@new_book = Book.open(@simple_file1, :if_unsaved => :invalid_option)
|
911
|
-
}.to raise_error(
|
911
|
+
}.to raise_error(OptionInvalid, ":if_unsaved: invalid option: :invalid_option")
|
912
912
|
end
|
913
913
|
end
|
914
914
|
|
@@ -937,7 +937,7 @@ describe Book do
|
|
937
937
|
it "should raise an error, if :if_obstructed is :raise" do
|
938
938
|
expect {
|
939
939
|
@new_book = Book.open(@simple_file1, :if_obstructed => :raise)
|
940
|
-
}.to raise_error(
|
940
|
+
}.to raise_error(WorkbookBlocked, /blocked by a workbook with the same name in a different path/)
|
941
941
|
end
|
942
942
|
|
943
943
|
it "should close the other book and open the new book, if :if_obstructed is :forget" do
|
@@ -961,7 +961,7 @@ describe Book do
|
|
961
961
|
if :if_obstructed is :close_if_saved" do
|
962
962
|
expect{
|
963
963
|
@new_book = Book.open(@simple_file1, :if_obstructed => :close_if_saved)
|
964
|
-
}.to raise_error(
|
964
|
+
}.to raise_error(WorkbookBlocked, /workbook with the same name in a different path is unsaved/)
|
965
965
|
@book.save
|
966
966
|
@new_book = Book.open(@simple_file1, :if_obstructed => :close_if_saved)
|
967
967
|
@book.should_not be_alive
|
@@ -983,13 +983,13 @@ describe Book do
|
|
983
983
|
it "should raise an error, if :if_obstructed is default" do
|
984
984
|
expect {
|
985
985
|
@new_book = Book.open(@simple_file1)
|
986
|
-
}.to raise_error(
|
986
|
+
}.to raise_error(WorkbookBlocked, /blocked by a workbook with the same name in a different path/)
|
987
987
|
end
|
988
988
|
|
989
989
|
it "should raise an error, if :if_obstructed is invalid option" do
|
990
990
|
expect {
|
991
991
|
@new_book = Book.open(@simple_file1, :if_obstructed => :invalid_option)
|
992
|
-
}.to raise_error(
|
992
|
+
}.to raise_error(OptionInvalid, ":if_obstructed: invalid option: :invalid_option")
|
993
993
|
end
|
994
994
|
end
|
995
995
|
end
|
@@ -1032,14 +1032,14 @@ describe Book do
|
|
1032
1032
|
it "should raise error if filename is nil" do
|
1033
1033
|
expect{
|
1034
1034
|
Book.open(@nonexisting)
|
1035
|
-
}.to raise_error(
|
1035
|
+
}.to raise_error(FileNameNotGiven, "filename is nil")
|
1036
1036
|
end
|
1037
1037
|
|
1038
1038
|
it "should raise error if file does not exist" do
|
1039
1039
|
File.delete @simple_save_file rescue nil
|
1040
1040
|
expect {
|
1041
1041
|
Book.open(@simple_save_file, :if_absent => :raise)
|
1042
|
-
}.to raise_error(
|
1042
|
+
}.to raise_error(FileNotFound, "file \"#{@simple_save_file}\" not found")
|
1043
1043
|
end
|
1044
1044
|
|
1045
1045
|
it "should create a workbook" do
|
@@ -1054,7 +1054,7 @@ describe Book do
|
|
1054
1054
|
File.delete @simple_save_file rescue nil
|
1055
1055
|
expect {
|
1056
1056
|
Book.open(@simple_save_file)
|
1057
|
-
}.to raise_error(
|
1057
|
+
}.to raise_error(FileNotFound, "file \"#{@simple_save_file}\" not found")
|
1058
1058
|
end
|
1059
1059
|
|
1060
1060
|
end
|
@@ -1079,29 +1079,24 @@ describe Book do
|
|
1079
1079
|
it "should set update_links to :alert" do
|
1080
1080
|
book = Book.open(@simple_file, :update_links => :alert)
|
1081
1081
|
book.UpdateLinks.should == XlUpdateLinksUserSetting
|
1082
|
-
#book.UpdateRemoteReferences.should be_true
|
1083
1082
|
book.Saved.should be_true
|
1084
1083
|
end
|
1085
1084
|
|
1086
1085
|
it "should set update_links to :never" do
|
1087
1086
|
book = Book.open(@simple_file, :update_links => :never)
|
1088
1087
|
book.UpdateLinks.should == XlUpdateLinksNever
|
1089
|
-
#book.UpdateRemoteReferences.should be_false
|
1090
1088
|
book = Book.open(@simple_file, :update_links => :foo)
|
1091
1089
|
book.UpdateLinks.should == XlUpdateLinksNever
|
1092
|
-
#book.UpdateRemoteReferences.should be_false
|
1093
1090
|
end
|
1094
1091
|
|
1095
1092
|
it "should set update_links to :always" do
|
1096
1093
|
book = Book.open(@simple_file, :update_links => :always)
|
1097
1094
|
book.UpdateLinks.should == XlUpdateLinksAlways
|
1098
|
-
#book.UpdateRemoteReferences.should be_true
|
1099
1095
|
end
|
1100
1096
|
|
1101
1097
|
it "should set update_links to :never per default" do
|
1102
1098
|
book = Book.open(@simple_file)
|
1103
1099
|
book.UpdateLinks.should == XlUpdateLinksNever
|
1104
|
-
#book.UpdateRemoteReferences.should be_false
|
1105
1100
|
end
|
1106
1101
|
|
1107
1102
|
end
|
@@ -1242,7 +1237,7 @@ describe Book do
|
|
1242
1237
|
expected_path = Regexp.new(File.expand_path(path).gsub(/\//, "."))
|
1243
1238
|
expect {
|
1244
1239
|
Book.open(path)
|
1245
|
-
}.to raise_error(
|
1240
|
+
}.to raise_error(FileNotFound, "file \"#{path}\" not found")
|
1246
1241
|
end
|
1247
1242
|
end
|
1248
1243
|
end
|
@@ -56,7 +56,7 @@ describe Book do
|
|
56
56
|
@book = Book.open(@simple_file, :read_only => true)
|
57
57
|
expect {
|
58
58
|
@book.save
|
59
|
-
}.to raise_error(
|
59
|
+
}.to raise_error(WorkbookReadOnly, "Not opened for writing (opened with :read_only option)")
|
60
60
|
@book.close
|
61
61
|
end
|
62
62
|
|
@@ -65,7 +65,7 @@ describe Book do
|
|
65
65
|
@book.close
|
66
66
|
expect{
|
67
67
|
@book.save
|
68
|
-
}.to raise_error(
|
68
|
+
}.to raise_error(ObjectNotAlive, "workbook is not alive")
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
@@ -82,7 +82,7 @@ describe Book do
|
|
82
82
|
it {
|
83
83
|
expect {
|
84
84
|
@book.save_as(@simple_file)
|
85
|
-
}.to raise_error(
|
85
|
+
}.to raise_error(WorkbookReadOnly,
|
86
86
|
"Not opened for writing (opened with :read_only option)")
|
87
87
|
}
|
88
88
|
end
|
@@ -100,7 +100,7 @@ describe Book do
|
|
100
100
|
book = Book.open(@simple_file)
|
101
101
|
expect{
|
102
102
|
book.save_as(@wrong_name)
|
103
|
-
}.to raise_error(
|
103
|
+
}.to raise_error(FileNameNotGiven, "filename is nil")
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should raise error if workbook is not alive" do
|
@@ -108,7 +108,7 @@ describe Book do
|
|
108
108
|
book.close
|
109
109
|
expect{
|
110
110
|
book.save_as(@simple_save_file)
|
111
|
-
}.to raise_error(
|
111
|
+
}.to raise_error(ObjectNotAlive, "workbook is not alive")
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -155,7 +155,7 @@ describe Book do
|
|
155
155
|
File.exist?(@simple_file_other_path1).should be_true
|
156
156
|
expect{
|
157
157
|
@book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :raise)
|
158
|
-
}.to raise_error(
|
158
|
+
}.to raise_error(WorkbookBlocked, /blocked by another workbook/)
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should close the blocking workbook without saving, and save the current workbook with :if_obstructed => :forget" do
|
@@ -237,7 +237,7 @@ describe Book do
|
|
237
237
|
@book.Saved.should be_false
|
238
238
|
expect{
|
239
239
|
@book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :close_if_saved)
|
240
|
-
}.to raise_error(
|
240
|
+
}.to raise_error(WorkbookBlocked, /blocking workbook is unsaved: "workbook.xls"/)
|
241
241
|
end
|
242
242
|
|
243
243
|
it "should raise an error with an invalid option" do
|
@@ -248,7 +248,7 @@ describe Book do
|
|
248
248
|
File.exist?(@simple_file_other_path1).should be_true
|
249
249
|
expect{
|
250
250
|
@book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :invalid)
|
251
|
-
}.to raise_error(
|
251
|
+
}.to raise_error(OptionInvalid, ":if_obstructed: invalid option: :invalid")
|
252
252
|
end
|
253
253
|
|
254
254
|
it "should raise an error by default" do
|
@@ -259,7 +259,7 @@ describe Book do
|
|
259
259
|
File.exist?(@simple_file_other_path1).should be_true
|
260
260
|
expect{
|
261
261
|
@book2.save_as(@simple_file_other_path1, :if_exists => :overwrite)
|
262
|
-
}.to raise_error(
|
262
|
+
}.to raise_error(WorkbookBlocked, /blocked by another workbook/)
|
263
263
|
end
|
264
264
|
|
265
265
|
it "should raise an error if the file does not exist and an workbook with the same name and other path exists" do
|
@@ -267,7 +267,7 @@ describe Book do
|
|
267
267
|
File.exist?(@simple_file_other_path1).should be_false
|
268
268
|
expect{
|
269
269
|
@book2.save_as(@simple_file_other_path1, :if_exists => :overwrite, :if_obstructed => :raise)
|
270
|
-
}.to raise_error(
|
270
|
+
}.to raise_error(WorkbookBlocked, /blocked by another workbook/)
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should raise an error if the file exists and an workbook with the same name and other path exists" do
|
@@ -278,7 +278,7 @@ describe Book do
|
|
278
278
|
File.exist?(@simple_file_other_path1).should be_true
|
279
279
|
expect{
|
280
280
|
@book.save_as(@simple_file_other_path1, :if_exists => :raise, :if_obstructed => :raise)
|
281
|
-
}.to raise_error(
|
281
|
+
}.to raise_error(FileAlreadyExists, /file already exists: "workbook.xls"/)
|
282
282
|
end
|
283
283
|
|
284
284
|
end
|
@@ -303,7 +303,7 @@ describe Book do
|
|
303
303
|
book_save = Book.open(@simple_save_file1, :excel => :new)
|
304
304
|
expect{
|
305
305
|
@book.save_as(@simple_save_file1, :if_exists => :overwrite)
|
306
|
-
}.to raise_error(
|
306
|
+
}.to raise_error(WorkbookBeingUsed, "workbook is open and used in Excel")
|
307
307
|
book_save.close
|
308
308
|
end
|
309
309
|
|
@@ -340,7 +340,7 @@ describe Book do
|
|
340
340
|
booklength = File.size?(@simple_save_file1)
|
341
341
|
expect {
|
342
342
|
@book.save_as(@simple_save_file1, :if_exists => :raise)
|
343
|
-
}.to raise_error(
|
343
|
+
}.to raise_error(FileAlreadyExists, /file already exists: "workbook_save.xls"/)
|
344
344
|
File.exist?(@simple_save_file1).should be_true
|
345
345
|
File.size?(@simple_save_file1).should == booklength
|
346
346
|
end
|
@@ -381,7 +381,7 @@ describe Book do
|
|
381
381
|
#@key_sender.puts "%{n}" #, :initial_wait => 0.2, :if_target_missing=>"Excel window not found")
|
382
382
|
expect{
|
383
383
|
@book.save_as(@simple_save_file1, :if_exists => :alert)
|
384
|
-
}.to raise_error(
|
384
|
+
}.to raise_error(WorkbookError, "not saved or canceled by user")
|
385
385
|
File.exist?(@simple_save_file1).should be_true
|
386
386
|
File.size?(@simple_save_file1).should == @garbage_length
|
387
387
|
@book.excel.DisplayAlerts.should == displayalert_value
|
@@ -396,7 +396,7 @@ describe Book do
|
|
396
396
|
#@key_sender.puts "%{n}" #, :initial_wait => 0.2, :if_target_missing=>"Excel window not found")
|
397
397
|
expect{
|
398
398
|
@book.save_as(@simple_save_file1, :if_exists => :alert)
|
399
|
-
}.to raise_error(
|
399
|
+
}.to raise_error(WorkbookError, "not saved or canceled by user")
|
400
400
|
File.exist?(@simple_save_file1).should be_true
|
401
401
|
File.size?(@simple_save_file1).should == @garbage_length
|
402
402
|
@book.excel.DisplayAlerts.should == displayalert_value
|
@@ -407,7 +407,7 @@ describe Book do
|
|
407
407
|
@book.ole_workbook.Close
|
408
408
|
expect{
|
409
409
|
@book.save_as(@simple_save_file1, :if_exists => :alert)
|
410
|
-
}.to raise_error(
|
410
|
+
}.to raise_error(ObjectNotAlive, "workbook is not alive")
|
411
411
|
File.exist?(@simple_save_file1).should be_true
|
412
412
|
File.size?(@simple_save_file1).should == @garbage_length
|
413
413
|
@book.excel.DisplayAlerts.should == displayalert_value
|
@@ -451,7 +451,7 @@ describe Book do
|
|
451
451
|
#@key_sender.puts "%{n}" #, :initial_wait => 0.2, :if_target_missing=>"Excel window not found")
|
452
452
|
expect{
|
453
453
|
@book.save_as(@simple_save_file1, :if_exists => :excel)
|
454
|
-
}.to raise_error(
|
454
|
+
}.to raise_error(WorkbookError, "not saved or canceled by user")
|
455
455
|
File.exist?(@simple_save_file1).should be_true
|
456
456
|
File.size?(@simple_save_file1).should == @garbage_length
|
457
457
|
@book.excel.DisplayAlerts.should == displayalert_value
|
@@ -466,7 +466,7 @@ describe Book do
|
|
466
466
|
#@key_sender.puts "%{n}" #, :initial_wait => 0.2, :if_target_missing=>"Excel window not found")
|
467
467
|
expect{
|
468
468
|
@book.save_as(@simple_save_file1, :if_exists => :excel)
|
469
|
-
}.
|
469
|
+
}.to_not raise_error
|
470
470
|
File.exist?(@simple_save_file1).should be_true
|
471
471
|
File.size?(@simple_save_file1).should == @garbage_length
|
472
472
|
@book.excel.DisplayAlerts.should == displayalert_value
|
@@ -477,7 +477,7 @@ describe Book do
|
|
477
477
|
@book.ole_workbook.Close
|
478
478
|
expect{
|
479
479
|
@book.save_as(@simple_save_file1, :if_exists => :excel)
|
480
|
-
}.to raise_error(
|
480
|
+
}.to raise_error(ObjectNotAlive, "workbook is not alive")
|
481
481
|
File.exist?(@simple_save_file1).should be_true
|
482
482
|
File.size?(@simple_save_file1).should == @garbage_length
|
483
483
|
@book.excel.DisplayAlerts.should == displayalert_value
|
@@ -495,7 +495,7 @@ describe Book do
|
|
495
495
|
booklength = File.size?(@simple_save_file1)
|
496
496
|
expect {
|
497
497
|
@book.save_as(@simple_save_file1)
|
498
|
-
}.to raise_error(
|
498
|
+
}.to raise_error(FileAlreadyExists, /file already exists: "workbook_save.xls"/)
|
499
499
|
File.exist?(@simple_save_file1).should be_true
|
500
500
|
File.size?(@simple_save_file1).should == booklength
|
501
501
|
end
|
@@ -505,7 +505,7 @@ describe Book do
|
|
505
505
|
@book.save_as(@simple_save_file1)
|
506
506
|
expect {
|
507
507
|
@book.save_as(@simple_save_file1, :if_exists => :invalid)
|
508
|
-
}.to raise_error(
|
508
|
+
}.to raise_error(OptionInvalid, ':if_exists: invalid option: :invalid')
|
509
509
|
end
|
510
510
|
end
|
511
511
|
end
|
@@ -183,7 +183,7 @@ describe Book do
|
|
183
183
|
@book.add_sheet(@sheet, :as => 'new_sheet')
|
184
184
|
expect{
|
185
185
|
@book.add_sheet(@sheet, :as => 'new_sheet')
|
186
|
-
}.to raise_error(
|
186
|
+
}.to raise_error(NameAlreadyExists, /sheet name "new_sheet" already exists/)
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
@@ -281,7 +281,7 @@ describe Book do
|
|
281
281
|
@book.copy_sheet(@sheet, :as => 'new_sheet')
|
282
282
|
expect{
|
283
283
|
@book.copy_sheet(@sheet, :as => 'new_sheet')
|
284
|
-
}.to raise_error(
|
284
|
+
}.to raise_error(NameAlreadyExists, /sheet name "new_sheet" already exists/)
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
@@ -381,7 +381,7 @@ describe Book do
|
|
381
381
|
@book.add_or_copy_sheet(@sheet, :as => 'new_sheet')
|
382
382
|
expect{
|
383
383
|
@book.add_or_copy_sheet(@sheet, :as => 'new_sheet')
|
384
|
-
}.to raise_error(
|
384
|
+
}.to raise_error(NameAlreadyExists, /sheet name "new_sheet" already exists/)
|
385
385
|
end
|
386
386
|
end
|
387
387
|
end
|
@@ -113,7 +113,7 @@ describe Book do
|
|
113
113
|
expect{
|
114
114
|
Book.unobtrusively(@simple_file, :invalid_option) do |book|
|
115
115
|
end
|
116
|
-
}.to raise_error(
|
116
|
+
}.to raise_error(TypeErrorREO, "given object is neither an Excel, a Workbook, nor a Win32ole")
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should be visible" do
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/data/workbook.xls
CHANGED
Binary file
|