robust_excel_ole 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +13 -0
- data/README.rdoc +107 -73
- data/{README_excel.rdoc → docs/README_excel.rdoc} +2 -0
- data/{README_open.rdoc → docs/README_open.rdoc} +12 -16
- data/{README_ranges.rdoc → docs/README_ranges.rdoc} +1 -1
- data/{README_save_close.rdoc → docs/README_save_close.rdoc} +0 -0
- data/{README_sheet.rdoc → docs/README_sheet.rdoc} +0 -0
- data/examples/open_save_close/example_control_to_excel.rb +3 -3
- data/examples/open_save_close/example_default_excel.rb +2 -2
- data/examples/open_save_close/example_force_excel.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_closeifsaved.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_forget.rb +2 -2
- data/examples/open_save_close/example_if_obstructed_save.rb +2 -2
- data/examples/open_save_close/example_if_unsaved_accept.rb +3 -3
- data/examples/open_save_close/example_if_unsaved_forget.rb +7 -3
- data/examples/open_save_close/example_if_unsaved_forget_more.rb +1 -1
- data/examples/open_save_close/example_read_only.rb +2 -2
- data/examples/open_save_close/example_rename_cells.rb +2 -2
- data/examples/open_save_close/example_reuse.rb +2 -2
- data/examples/open_save_close/example_simple.rb +1 -1
- data/examples/open_save_close/example_unobtrusively.rb +2 -2
- data/lib/robust_excel_ole/book.rb +75 -76
- data/lib/robust_excel_ole/bookstore.rb +9 -9
- data/lib/robust_excel_ole/excel.rb +5 -5
- data/lib/robust_excel_ole/general.rb +11 -4
- data/lib/robust_excel_ole/reo_common.rb +3 -0
- data/lib/robust_excel_ole/version.rb +1 -1
- data/robust_excel_ole.gemspec +2 -2
- data/spec/book_spec.rb +67 -63
- data/spec/book_specs/book_close_spec.rb +12 -10
- data/spec/book_specs/book_misc_spec.rb +279 -279
- data/spec/book_specs/book_open_spec.rb +258 -105
- data/spec/book_specs/book_save_spec.rb +28 -28
- data/spec/book_specs/book_unobtr_spec.rb +862 -164
- data/spec/bookstore_spec.rb +22 -22
- data/spec/data/another_workbook.xls +0 -0
- data/spec/data/different_workbook.xls +0 -0
- data/spec/data/workbook.xls +0 -0
- data/spec/excel_spec.rb +256 -254
- data/spec/general_spec.rb +7 -7
- data/spec/ruby1.8.6_rspec2.14/book_spec.rb +1421 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_all_spec.rb +22 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_close_spec.rb +252 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_misc_spec.rb +1070 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_open_spec.rb +1855 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_save_spec.rb +514 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_sheet_spec.rb +395 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_subclass_spec.rb +51 -0
- data/spec/ruby1.8.6_rspec2.14/book_specs/book_unobtr_spec.rb +1737 -0
- data/spec/ruby1.8.6_rspec2.14/bookstore_spec.rb +495 -0
- data/spec/ruby1.8.6_rspec2.14/cell_spec.rb +76 -0
- data/spec/ruby1.8.6_rspec2.14/cygwin_spec.rb +42 -0
- data/spec/ruby1.8.6_rspec2.14/excel_spec.rb +1820 -0
- data/spec/ruby1.8.6_rspec2.14/general_spec.rb +212 -0
- data/spec/ruby1.8.6_rspec2.14/range_spec.rb +131 -0
- data/spec/ruby1.8.6_rspec2.14/reo_common_spec.rb +130 -0
- data/spec/ruby1.8.6_rspec2.14/sheet_spec.rb +663 -0
- data/spec/ruby1.8.6_rspec2.14/spec_helper.rb +35 -0
- data/spec/sheet_spec.rb +2 -2
- metadata +28 -12
- data/README_detail.rdoc +0 -852
- data/README_development.rdoc +0 -5
data/spec/bookstore_spec.rb
CHANGED
@@ -181,8 +181,8 @@ describe Bookstore do
|
|
181
181
|
it "should fetch the first, writable book" do
|
182
182
|
@book2 = Book.open(@simple_file1, :force_excel => :new)
|
183
183
|
@bookstore.store(@book2)
|
184
|
-
@book.ReadOnly.should
|
185
|
-
@book2.ReadOnly.should
|
184
|
+
@book.ReadOnly.should be false
|
185
|
+
@book2.ReadOnly.should be true
|
186
186
|
new_book = @bookstore.fetch(@simple_file1)
|
187
187
|
new_book.should == @book
|
188
188
|
new_book.should_not == @book2
|
@@ -192,8 +192,8 @@ describe Bookstore do
|
|
192
192
|
it "should fetch the last book with :prefer_writeable => false" do
|
193
193
|
@book2 = Book.open(@simple_file1, :force_excel => :new)
|
194
194
|
@bookstore.store(@book2)
|
195
|
-
@book.ReadOnly.should
|
196
|
-
@book2.ReadOnly.should
|
195
|
+
@book.ReadOnly.should be false
|
196
|
+
@book2.ReadOnly.should be true
|
197
197
|
new_book = @bookstore.fetch(@simple_file1, :prefer_writable => false)
|
198
198
|
new_book.should_not == @book
|
199
199
|
new_book.should == @book2
|
@@ -203,8 +203,8 @@ describe Bookstore do
|
|
203
203
|
it "should fetch the second, open book, if the first book is closed" do
|
204
204
|
@book2 = Book.open(@simple_file1, :force_excel => :new)
|
205
205
|
@bookstore.store(@book2)
|
206
|
-
@book.ReadOnly.should
|
207
|
-
@book2.ReadOnly.should
|
206
|
+
@book.ReadOnly.should be false
|
207
|
+
@book2.ReadOnly.should be true
|
208
208
|
@book.close
|
209
209
|
new_book = @bookstore.fetch(@simple_file1, :prefer_writable => false)
|
210
210
|
new_book2 = @bookstore.fetch(@simple_file1)
|
@@ -219,8 +219,8 @@ describe Bookstore do
|
|
219
219
|
it "should fetch the first, open book, if the second book is closed, even with :prefer_writeable => false" do
|
220
220
|
@book2 = Book.open(@simple_file1, :force_excel => :new)
|
221
221
|
@bookstore.store(@book2)
|
222
|
-
@book.ReadOnly.should
|
223
|
-
@book2.ReadOnly.should
|
222
|
+
@book.ReadOnly.should be false
|
223
|
+
@book2.ReadOnly.should be true
|
224
224
|
@book2.close
|
225
225
|
new_book = @bookstore.fetch(@simple_file1, :prefer_writable => false)
|
226
226
|
new_book2 = @bookstore.fetch(@simple_file1)
|
@@ -249,8 +249,8 @@ describe Bookstore do
|
|
249
249
|
it "should fetch the second, writable book" do
|
250
250
|
@book2 = Book.open(@simple_file1, :force_excel => :new)
|
251
251
|
@bookstore.store(@book2)
|
252
|
-
@book.ReadOnly.should
|
253
|
-
@book2.ReadOnly.should
|
252
|
+
@book.ReadOnly.should be true
|
253
|
+
@book2.ReadOnly.should be false
|
254
254
|
new_book = @bookstore.fetch(@simple_file1)
|
255
255
|
new_book2 = @bookstore.fetch(@simple_file1, :prefer_writable => true)
|
256
256
|
new_book3 = @bookstore.fetch(@simple_file1, :prefer_writable => false)
|
@@ -268,8 +268,8 @@ describe Bookstore do
|
|
268
268
|
it "should fetch the recent readonly book when there are only readonly books" do
|
269
269
|
@book2 = Book.open(@simple_file1, :force_excel => :new, :read_only => true)
|
270
270
|
@bookstore.store(@book2)
|
271
|
-
@book.ReadOnly.should
|
272
|
-
@book2.ReadOnly.should
|
271
|
+
@book.ReadOnly.should be true
|
272
|
+
@book2.ReadOnly.should be true
|
273
273
|
new_book = @bookstore.fetch(@simple_file1)
|
274
274
|
new_book.should == @book2
|
275
275
|
new_book.should_not == @book
|
@@ -283,10 +283,10 @@ describe Bookstore do
|
|
283
283
|
@bookstore.store(@book3)
|
284
284
|
sheet = @book3.sheet(1)
|
285
285
|
sheet[1,1] = sheet[1,1].Value == "foo" ? "bar" : "foo"
|
286
|
-
@book.ReadOnly.should
|
287
|
-
@book2.ReadOnly.should
|
288
|
-
@book3.ReadOnly.should
|
289
|
-
@book3.Saved.should
|
286
|
+
@book.ReadOnly.should be true
|
287
|
+
@book2.ReadOnly.should be false
|
288
|
+
@book3.ReadOnly.should be true
|
289
|
+
@book3.Saved.should be false
|
290
290
|
new_book = @bookstore.fetch(@simple_file1)
|
291
291
|
new_book2 = @bookstore.fetch(@simple_file1, :prefer_writable => false)
|
292
292
|
new_book.should == @book2
|
@@ -358,8 +358,8 @@ describe Bookstore do
|
|
358
358
|
end
|
359
359
|
|
360
360
|
it "should fetch the book in the given excel instance" do
|
361
|
-
@book.ReadOnly.should
|
362
|
-
@book2.ReadOnly.should
|
361
|
+
@book.ReadOnly.should be false
|
362
|
+
@book2.ReadOnly.should be true
|
363
363
|
book_new = @bookstore.fetch(@simple_file, :prefer_excel => @book2.excel)
|
364
364
|
book_new.should be_a Book
|
365
365
|
book_new.should be_alive
|
@@ -466,8 +466,8 @@ describe Bookstore do
|
|
466
466
|
it "should create and use a hidden Excel instance" do
|
467
467
|
h_excel1 = @bookstore.hidden_excel
|
468
468
|
h_excel1.should_not == @book.excel
|
469
|
-
h_excel1.Visible.should
|
470
|
-
h_excel1.DisplayAlerts.should
|
469
|
+
h_excel1.Visible.should be false
|
470
|
+
h_excel1.DisplayAlerts.should be false
|
471
471
|
book1 = Book.open(@simple_file, :force_excel => @bookstore.hidden_excel)
|
472
472
|
book1.excel.should === h_excel1
|
473
473
|
book1.excel.should_not === @book.excel
|
@@ -475,8 +475,8 @@ describe Bookstore do
|
|
475
475
|
h_excel2 = @bookstore.hidden_excel
|
476
476
|
h_excel2.should_not == @book.excel
|
477
477
|
h_excel2.should_not == book1.excel
|
478
|
-
h_excel2.Visible.should
|
479
|
-
h_excel2.DisplayAlerts.should
|
478
|
+
h_excel2.Visible.should be false
|
479
|
+
h_excel2.DisplayAlerts.should be false
|
480
480
|
book2 = Book.open(@simple_file, :force_excel => @bookstore.hidden_excel)
|
481
481
|
book2.excel.should === h_excel2
|
482
482
|
book2.excel.should_not === @book.excel
|
Binary file
|
Binary file
|
data/spec/data/workbook.xls
CHANGED
Binary file
|
data/spec/excel_spec.rb
CHANGED
@@ -27,7 +27,7 @@ module RobustExcelOle
|
|
27
27
|
|
28
28
|
after do
|
29
29
|
Excel.kill_all
|
30
|
-
rm_tmp(@dir)
|
30
|
+
#rm_tmp(@dir)
|
31
31
|
end
|
32
32
|
|
33
33
|
context "Illegal Refrence" do
|
@@ -48,9 +48,10 @@ module RobustExcelOle
|
|
48
48
|
context "excel creation" do
|
49
49
|
|
50
50
|
def creation_ok? # :nodoc: #
|
51
|
-
@excel.alive
|
52
|
-
@excel.
|
53
|
-
@excel.
|
51
|
+
@excel.alive?
|
52
|
+
@excel.Screenupdating.should be true
|
53
|
+
@excel.Visible.should be false
|
54
|
+
@excel.DisplayAlerts.should be false
|
54
55
|
@excel.Name.should == "Microsoft Excel"
|
55
56
|
end
|
56
57
|
|
@@ -113,8 +114,8 @@ module RobustExcelOle
|
|
113
114
|
excel.should be_a Excel
|
114
115
|
excel.should be_alive
|
115
116
|
excel.should === @excel
|
116
|
-
excel.Visible.should
|
117
|
-
excel.DisplayAlerts.should
|
117
|
+
excel.Visible.should be true
|
118
|
+
excel.DisplayAlerts.should be true
|
118
119
|
end
|
119
120
|
|
120
121
|
end
|
@@ -222,8 +223,8 @@ module RobustExcelOle
|
|
222
223
|
|
223
224
|
it "should kill Excel processes" do
|
224
225
|
Excel.kill_all
|
225
|
-
@excel1.alive?.should
|
226
|
-
@excel2.alive?.should
|
226
|
+
@excel1.alive?.should be false
|
227
|
+
@excel2.alive?.should be false
|
227
228
|
end
|
228
229
|
end
|
229
230
|
|
@@ -242,8 +243,8 @@ module RobustExcelOle
|
|
242
243
|
@excel1.recreate
|
243
244
|
@excel1.should be_a Excel
|
244
245
|
@excel1.should be_alive
|
245
|
-
@excel1.Visible.should
|
246
|
-
@excel1.DisplayAlerts.should
|
246
|
+
@excel1.Visible.should be false
|
247
|
+
@excel1.DisplayAlerts.should be false
|
247
248
|
@book1.should_not be_alive
|
248
249
|
@book1.reopen
|
249
250
|
@book1.should be_alive
|
@@ -259,8 +260,8 @@ module RobustExcelOle
|
|
259
260
|
@excel1.recreate
|
260
261
|
@excel1.should be_a Excel
|
261
262
|
@excel1.should be_alive
|
262
|
-
@excel1.Visible.should
|
263
|
-
@excel1.DisplayAlerts.should
|
263
|
+
@excel1.Visible.should be true
|
264
|
+
@excel1.DisplayAlerts.should be true
|
264
265
|
@book1.reopen
|
265
266
|
@book1.should be_alive
|
266
267
|
@excel1.close
|
@@ -273,8 +274,8 @@ module RobustExcelOle
|
|
273
274
|
@excel1.recreate(:visible => true, :displayalerts => true)
|
274
275
|
@excel1.should be_a Excel
|
275
276
|
@excel1.should be_alive
|
276
|
-
@excel1.Visible.should
|
277
|
-
@excel1.DisplayAlerts.should
|
277
|
+
@excel1.Visible.should be true
|
278
|
+
@excel1.DisplayAlerts.should be true
|
278
279
|
@book1.reopen
|
279
280
|
@book1.should be_alive
|
280
281
|
@excel1.close
|
@@ -287,8 +288,8 @@ module RobustExcelOle
|
|
287
288
|
@excel1.recreate(:reopen_workbooks => true)
|
288
289
|
@excel1.should be_a Excel
|
289
290
|
@excel1.should be_alive
|
290
|
-
@excel1.Visible.should
|
291
|
-
@excel1.DisplayAlerts.should
|
291
|
+
@excel1.Visible.should be false
|
292
|
+
@excel1.DisplayAlerts.should be false
|
292
293
|
@book1.should be_alive
|
293
294
|
@excel1.close
|
294
295
|
@excel1.should_not be_alive
|
@@ -316,15 +317,15 @@ module RobustExcelOle
|
|
316
317
|
@excel1.recreate(:reopen_workbooks => true, :displayalerts => true)
|
317
318
|
@excel1.should be_alive
|
318
319
|
@excel1.should be_a Excel
|
319
|
-
@excel1.Visible.should
|
320
|
-
@excel1.DisplayAlerts.should
|
320
|
+
@excel1.Visible.should be true
|
321
|
+
@excel1.DisplayAlerts.should be true
|
321
322
|
@book1.should be_alive
|
322
323
|
@book2.should be_alive
|
323
324
|
@excel3.recreate(:visible => true)
|
324
325
|
@excel3.should be_alive
|
325
326
|
@excel3.should be_a Excel
|
326
|
-
@excel3.Visible.should
|
327
|
-
@excel3.DisplayAlerts.should
|
327
|
+
@excel3.Visible.should be true
|
328
|
+
@excel3.DisplayAlerts.should be true
|
328
329
|
@book3.reopen
|
329
330
|
@book3.should be_alive
|
330
331
|
@book3.excel.should == @excel3
|
@@ -398,7 +399,7 @@ module RobustExcelOle
|
|
398
399
|
sheet1 = book1.sheet(1)
|
399
400
|
@old_cell_value1 = sheet1[1,1].value
|
400
401
|
sheet1[1,1] = sheet1[1,1].value == "foo" ? "bar" : "foo"
|
401
|
-
book1.Saved.should
|
402
|
+
book1.Saved.should be false
|
402
403
|
end
|
403
404
|
|
404
405
|
it "should save the unsaved workbook" do
|
@@ -535,7 +536,7 @@ module RobustExcelOle
|
|
535
536
|
sleep 0.2
|
536
537
|
expect{
|
537
538
|
@ole_xl.Name
|
538
|
-
}.to raise_error(WIN32OLERuntimeError)
|
539
|
+
}.to raise_error #(WIN32OLERuntimeError)
|
539
540
|
@book1.excel.should_not be_alive
|
540
541
|
@book2.excel.should be_alive
|
541
542
|
@book3.excel.should_not be_alive
|
@@ -549,7 +550,7 @@ module RobustExcelOle
|
|
549
550
|
sleep 0.2
|
550
551
|
expect{
|
551
552
|
@ole_xl.Name
|
552
|
-
}.to raise_error(RuntimeError,
|
553
|
+
}.to raise_error(RuntimeError, /failed to get/)
|
553
554
|
@book1.excel.should_not be_alive
|
554
555
|
@book2.excel.should_not be_alive
|
555
556
|
@book3.excel.should_not be_alive
|
@@ -601,9 +602,9 @@ module RobustExcelOle
|
|
601
602
|
sheet2[1,1] = sheet2[1,1].value == "foo" ? "bar" : "foo"
|
602
603
|
@excel.should be_alive
|
603
604
|
@book.should be_alive
|
604
|
-
@book.saved.should
|
605
|
+
@book.saved.should be false
|
605
606
|
@book2.should be_alive
|
606
|
-
@book2.saved.should
|
607
|
+
@book2.saved.should be false
|
607
608
|
end
|
608
609
|
|
609
610
|
it "should raise an error" do
|
@@ -693,7 +694,7 @@ module RobustExcelOle
|
|
693
694
|
it "should not save if user answers 'no'" do
|
694
695
|
@excel.should be_alive
|
695
696
|
@book.should be_alive
|
696
|
-
@book.saved.should
|
697
|
+
@book.saved.should be false
|
697
698
|
@key_sender.puts "{right}{enter}"
|
698
699
|
result = @excel.close(:if_unsaved => :alert)
|
699
700
|
@excel.should_not be_alive
|
@@ -709,7 +710,7 @@ module RobustExcelOle
|
|
709
710
|
# strangely, in the "cancel" case, the question will sometimes be repeated twice
|
710
711
|
@excel.should be_alive
|
711
712
|
@book.should be_alive
|
712
|
-
@book.saved.should
|
713
|
+
@book.saved.should be false
|
713
714
|
@key_sender.puts "{left}{enter}"
|
714
715
|
@key_sender.puts "{left}{enter}"
|
715
716
|
expect{
|
@@ -791,7 +792,7 @@ module RobustExcelOle
|
|
791
792
|
@book3 = Book.open(@different_file)
|
792
793
|
sheet2 = @book2.sheet(1)
|
793
794
|
sheet2[1,1] = sheet2[1,1].value == "foo" ? "bar" : "foo"
|
794
|
-
@book2.Saved.should
|
795
|
+
@book2.Saved.should be false
|
795
796
|
@excel = Excel.current
|
796
797
|
end
|
797
798
|
|
@@ -799,14 +800,14 @@ module RobustExcelOle
|
|
799
800
|
@excel.retain_saved_workbooks do
|
800
801
|
sheet1 = @book1.sheet(1)
|
801
802
|
sheet1[1,1] = sheet1[1,1].value == "foo" ? "bar" : "foo"
|
802
|
-
@book1.Saved.should
|
803
|
+
@book1.Saved.should be false
|
803
804
|
sheet3 = @book3.sheet(1)
|
804
805
|
sheet3[1,1] = sheet3[1,1].value == "foo" ? "bar" : "foo"
|
805
|
-
@book3.Saved.should
|
806
|
+
@book3.Saved.should be false
|
806
807
|
end
|
807
|
-
@book1.Saved.should
|
808
|
-
@book2.Saved.should
|
809
|
-
@book3.Saved.should
|
808
|
+
@book1.Saved.should be true
|
809
|
+
@book2.Saved.should be false
|
810
|
+
@book3.Saved.should be true
|
810
811
|
end
|
811
812
|
end
|
812
813
|
|
@@ -821,8 +822,8 @@ module RobustExcelOle
|
|
821
822
|
@book3 = Book.open(@different_file, :read_only => true)
|
822
823
|
sheet3 = @book3.sheet(1)
|
823
824
|
sheet3[1,1] = sheet3[1,1].value == "foo" ? "bar" : "foo"
|
824
|
-
@book.Saved.should
|
825
|
-
@book3.Saved.should
|
825
|
+
@book.Saved.should be false
|
826
|
+
@book3.Saved.should be false
|
826
827
|
end
|
827
828
|
|
828
829
|
it "should list unsaved workbooks" do
|
@@ -834,7 +835,7 @@ module RobustExcelOle
|
|
834
835
|
end
|
835
836
|
|
836
837
|
it "should yield true, that there are unsaved workbooks" do
|
837
|
-
Excel.contains_unsaved_workbooks?.should
|
838
|
+
Excel.contains_unsaved_workbooks?.should be true
|
838
839
|
end
|
839
840
|
end
|
840
841
|
end
|
@@ -931,13 +932,13 @@ module RobustExcelOle
|
|
931
932
|
|
932
933
|
it "should yield alive" do
|
933
934
|
excel = Excel.create
|
934
|
-
excel.alive?.should
|
935
|
+
excel.alive?.should be true
|
935
936
|
end
|
936
937
|
|
937
938
|
it "should yield not alive" do
|
938
939
|
excel = Excel.create
|
939
940
|
excel.close
|
940
|
-
excel.alive?.should
|
941
|
+
excel.alive?.should be false
|
941
942
|
end
|
942
943
|
|
943
944
|
end
|
@@ -979,7 +980,7 @@ module RobustExcelOle
|
|
979
980
|
it "should focus" do
|
980
981
|
excel = Excel.create
|
981
982
|
excel.focus
|
982
|
-
excel.Visible.should
|
983
|
+
excel.Visible.should be true
|
983
984
|
end
|
984
985
|
|
985
986
|
end
|
@@ -992,294 +993,294 @@ module RobustExcelOle
|
|
992
993
|
excel1 = Excel.create
|
993
994
|
excel2 = Excel.create
|
994
995
|
excel1.focus
|
995
|
-
excel1.Visible.should
|
996
|
-
excel1.visible.should
|
996
|
+
excel1.Visible.should be true
|
997
|
+
excel1.visible.should be true
|
997
998
|
end
|
998
999
|
|
999
1000
|
it "should set default values" do
|
1000
1001
|
excel1 = Excel.new
|
1001
|
-
excel1.Visible.should
|
1002
|
-
excel1.DisplayAlerts.should
|
1003
|
-
excel1.visible.should
|
1002
|
+
excel1.Visible.should be false
|
1003
|
+
excel1.DisplayAlerts.should be false
|
1004
|
+
excel1.visible.should be false
|
1004
1005
|
excel1.displayalerts.should == :if_visible
|
1005
1006
|
end
|
1006
1007
|
|
1007
1008
|
it "should set visible true" do
|
1008
1009
|
excel1 = Excel.new(:visible => true)
|
1009
|
-
excel1.Visible.should
|
1010
|
-
excel1.DisplayAlerts.should
|
1011
|
-
excel1.visible.should
|
1010
|
+
excel1.Visible.should be true
|
1011
|
+
excel1.DisplayAlerts.should be true
|
1012
|
+
excel1.visible.should be true
|
1012
1013
|
excel1.displayalerts.should == :if_visible
|
1013
1014
|
end
|
1014
1015
|
|
1015
1016
|
it "should set visible false" do
|
1016
1017
|
excel1 = Excel.new(:visible => false)
|
1017
|
-
excel1.Visible.should
|
1018
|
-
excel1.DisplayAlerts.should
|
1019
|
-
excel1.visible.should
|
1018
|
+
excel1.Visible.should be false
|
1019
|
+
excel1.DisplayAlerts.should be false
|
1020
|
+
excel1.visible.should be false
|
1020
1021
|
excel1.displayalerts.should == :if_visible
|
1021
1022
|
end
|
1022
1023
|
|
1023
1024
|
it "should set displayalerts true" do
|
1024
1025
|
excel1 = Excel.new(:displayalerts => true)
|
1025
|
-
excel1.Visible.should
|
1026
|
-
excel1.DisplayAlerts.should
|
1027
|
-
excel1.visible.should
|
1028
|
-
excel1.displayalerts.should
|
1026
|
+
excel1.Visible.should be false
|
1027
|
+
excel1.DisplayAlerts.should be true
|
1028
|
+
excel1.visible.should be false
|
1029
|
+
excel1.displayalerts.should be true
|
1029
1030
|
end
|
1030
1031
|
|
1031
1032
|
it "should set displayalerts false" do
|
1032
1033
|
excel1 = Excel.new(:displayalerts => false)
|
1033
|
-
excel1.Visible.should
|
1034
|
-
excel1.DisplayAlerts.should
|
1035
|
-
excel1.visible.should
|
1036
|
-
excel1.displayalerts.should
|
1034
|
+
excel1.Visible.should be false
|
1035
|
+
excel1.DisplayAlerts.should be false
|
1036
|
+
excel1.visible.should be false
|
1037
|
+
excel1.displayalerts.should be false
|
1037
1038
|
end
|
1038
1039
|
|
1039
1040
|
it "should use values of the current Excel when reusing" do
|
1040
1041
|
excel1 = Excel.create
|
1041
|
-
excel1.Visible.should
|
1042
|
-
excel1.DisplayAlerts.should
|
1043
|
-
excel1.visible.should
|
1042
|
+
excel1.Visible.should be false
|
1043
|
+
excel1.DisplayAlerts.should be false
|
1044
|
+
excel1.visible.should be false
|
1044
1045
|
excel1.displayalerts.should == :if_visible
|
1045
1046
|
excel1.Visible = true
|
1046
1047
|
excel1.DisplayAlerts = true
|
1047
|
-
excel1.Visible.should
|
1048
|
-
excel1.DisplayAlerts.should
|
1048
|
+
excel1.Visible.should be true
|
1049
|
+
excel1.DisplayAlerts.should be true
|
1049
1050
|
excel2 = Excel.new(:reuse => true)
|
1050
|
-
excel2.Visible.should
|
1051
|
-
excel2.DisplayAlerts.should
|
1051
|
+
excel2.Visible.should be true
|
1052
|
+
excel2.DisplayAlerts.should be true
|
1052
1053
|
end
|
1053
1054
|
|
1054
1055
|
it "should take visible and displayalerts from Visible and DisplayAlerts of the connected Excel" do
|
1055
1056
|
excel1 = Excel.create
|
1056
1057
|
excel2 = Excel.current
|
1057
|
-
excel2.Visible.should
|
1058
|
-
excel2.visible.should
|
1059
|
-
excel2.DisplayAlerts.should
|
1058
|
+
excel2.Visible.should be false
|
1059
|
+
excel2.visible.should be false
|
1060
|
+
excel2.DisplayAlerts.should be false
|
1060
1061
|
excel2.displayalerts.should == :if_visible
|
1061
1062
|
end
|
1062
1063
|
|
1063
1064
|
it "should take Visible and DisplayAlerts from the connected Excel" do
|
1064
1065
|
excel1 = Excel.create
|
1065
1066
|
excel2 = Excel.current(:visible => true)
|
1066
|
-
excel2.Visible.should
|
1067
|
-
excel2.visible.should
|
1068
|
-
excel2.DisplayAlerts.should
|
1067
|
+
excel2.Visible.should be true
|
1068
|
+
excel2.visible.should be true
|
1069
|
+
excel2.DisplayAlerts.should be true
|
1069
1070
|
excel2.displayalerts.should == :if_visible
|
1070
1071
|
end
|
1071
1072
|
|
1072
1073
|
it "should set Excel visible and invisible with current" do
|
1073
1074
|
excel1 = Excel.new(:reuse => false, :visible => true)
|
1074
|
-
excel1.Visible.should
|
1075
|
-
excel1.visible.should
|
1076
|
-
excel1.DisplayAlerts.should
|
1075
|
+
excel1.Visible.should be true
|
1076
|
+
excel1.visible.should be true
|
1077
|
+
excel1.DisplayAlerts.should be true
|
1077
1078
|
excel1.displayalerts.should == :if_visible
|
1078
1079
|
excel1.visible = false
|
1079
|
-
excel1.Visible.should
|
1080
|
-
excel1.visible.should
|
1081
|
-
excel1.DisplayAlerts.should
|
1080
|
+
excel1.Visible.should be false
|
1081
|
+
excel1.visible.should be false
|
1082
|
+
excel1.DisplayAlerts.should be false
|
1082
1083
|
excel1.displayalerts.should == :if_visible
|
1083
1084
|
excel2 = Excel.current(:visible => true)
|
1084
|
-
excel2.Visible.should
|
1085
|
-
excel2.visible.should
|
1085
|
+
excel2.Visible.should be true
|
1086
|
+
excel2.visible.should be true
|
1086
1087
|
excel2.displayalerts.should == :if_visible
|
1087
|
-
excel2.DisplayAlerts.should
|
1088
|
+
excel2.DisplayAlerts.should be true
|
1088
1089
|
end
|
1089
1090
|
|
1090
1091
|
it "should set Excel visible and invisible" do
|
1091
1092
|
excel = Excel.new(:reuse => false, :visible => true)
|
1092
|
-
excel.Visible.should
|
1093
|
-
excel.visible.should
|
1094
|
-
excel.DisplayAlerts.should
|
1093
|
+
excel.Visible.should be true
|
1094
|
+
excel.visible.should be true
|
1095
|
+
excel.DisplayAlerts.should be true
|
1095
1096
|
excel.displayalerts.should == :if_visible
|
1096
1097
|
excel.visible = false
|
1097
|
-
excel.Visible.should
|
1098
|
-
excel.visible.should
|
1099
|
-
excel.DisplayAlerts.should
|
1098
|
+
excel.Visible.should be false
|
1099
|
+
excel.visible.should be false
|
1100
|
+
excel.DisplayAlerts.should be false
|
1100
1101
|
excel.displayalerts.should == :if_visible
|
1101
1102
|
excel7 = Excel.current
|
1102
1103
|
excel7.should === excel
|
1103
|
-
excel7.Visible.should
|
1104
|
-
excel7.DisplayAlerts.should
|
1104
|
+
excel7.Visible.should be false
|
1105
|
+
excel7.DisplayAlerts.should be false
|
1105
1106
|
excel1 = Excel.create(:visible => true)
|
1106
1107
|
excel1.should_not == excel
|
1107
|
-
excel1.Visible.should
|
1108
|
-
excel1.visible.should
|
1109
|
-
excel1.DisplayAlerts.should
|
1108
|
+
excel1.Visible.should be true
|
1109
|
+
excel1.visible.should be true
|
1110
|
+
excel1.DisplayAlerts.should be true
|
1110
1111
|
excel1.displayalerts.should == :if_visible
|
1111
1112
|
excel2 = Excel.create(:visible => false)
|
1112
|
-
excel2.Visible.should
|
1113
|
-
excel2.visible.should
|
1114
|
-
excel2.DisplayAlerts.should
|
1113
|
+
excel2.Visible.should be false
|
1114
|
+
excel2.visible.should be false
|
1115
|
+
excel2.DisplayAlerts.should be false
|
1115
1116
|
excel2.displayalerts.should == :if_visible
|
1116
1117
|
excel3 = Excel.current
|
1117
1118
|
excel3.should === excel
|
1118
|
-
excel3.Visible.should
|
1119
|
-
excel3.visible.should
|
1120
|
-
excel3.DisplayAlerts.should
|
1119
|
+
excel3.Visible.should be false
|
1120
|
+
excel3.visible.should be false
|
1121
|
+
excel3.DisplayAlerts.should be false
|
1121
1122
|
excel3.displayalerts.should == :if_visible
|
1122
1123
|
excel4 = Excel.current(:visible => true)
|
1123
1124
|
excel4.should === excel
|
1124
|
-
excel4.Visible.should
|
1125
|
-
excel4.visible.should
|
1126
|
-
excel4.DisplayAlerts.should
|
1125
|
+
excel4.Visible.should be true
|
1126
|
+
excel4.visible.should be true
|
1127
|
+
excel4.DisplayAlerts.should be true
|
1127
1128
|
excel4.displayalerts.should == :if_visible
|
1128
1129
|
excel5 = Excel.current(:visible => false)
|
1129
1130
|
excel5.should === excel
|
1130
|
-
excel5.Visible.should
|
1131
|
-
excel5.visible.should
|
1132
|
-
excel5.DisplayAlerts.should
|
1131
|
+
excel5.Visible.should be false
|
1132
|
+
excel5.visible.should be false
|
1133
|
+
excel5.DisplayAlerts.should be false
|
1133
1134
|
excel5.displayalerts.should == :if_visible
|
1134
1135
|
end
|
1135
1136
|
|
1136
1137
|
it "should enable or disable Excel DispayAlerts" do
|
1137
1138
|
excel = Excel.new(:reuse => false, :displayalerts => true)
|
1138
|
-
excel.DisplayAlerts.should
|
1139
|
-
excel.displayalerts.should
|
1140
|
-
excel.Visible.should
|
1141
|
-
excel.visible.should
|
1139
|
+
excel.DisplayAlerts.should be true
|
1140
|
+
excel.displayalerts.should be true
|
1141
|
+
excel.Visible.should be false
|
1142
|
+
excel.visible.should be false
|
1142
1143
|
excel6 = Excel.current
|
1143
1144
|
excel6.should === excel
|
1144
|
-
excel6.DisplayAlerts.should
|
1145
|
-
excel6.displayalerts.should
|
1146
|
-
excel6.Visible.should
|
1147
|
-
excel6.visible.should
|
1145
|
+
excel6.DisplayAlerts.should be true
|
1146
|
+
excel6.displayalerts.should be true
|
1147
|
+
excel6.Visible.should be false
|
1148
|
+
excel6.visible.should be false
|
1148
1149
|
excel.displayalerts = false
|
1149
|
-
excel.DisplayAlerts.should
|
1150
|
-
excel.displayalerts.should
|
1151
|
-
excel.Visible.should
|
1152
|
-
excel.visible.should
|
1150
|
+
excel.DisplayAlerts.should be false
|
1151
|
+
excel.displayalerts.should be false
|
1152
|
+
excel.Visible.should be false
|
1153
|
+
excel.visible.should be false
|
1153
1154
|
excel7 = Excel.current
|
1154
1155
|
excel7.should === excel
|
1155
|
-
excel7.DisplayAlerts.should
|
1156
|
-
excel7.displayalerts.should
|
1157
|
-
excel7.Visible.should
|
1158
|
-
excel7.visible.should
|
1156
|
+
excel7.DisplayAlerts.should be false
|
1157
|
+
excel7.displayalerts.should be false
|
1158
|
+
excel7.Visible.should be false
|
1159
|
+
excel7.visible.should be false
|
1159
1160
|
excel1 = Excel.create(:displayalerts => true)
|
1160
1161
|
excel1.should_not == excel
|
1161
|
-
excel1.DisplayAlerts.should
|
1162
|
-
excel1.displayalerts.should
|
1163
|
-
excel1.Visible.should
|
1164
|
-
excel1.visible.should
|
1162
|
+
excel1.DisplayAlerts.should be true
|
1163
|
+
excel1.displayalerts.should be true
|
1164
|
+
excel1.Visible.should be false
|
1165
|
+
excel1.visible.should be false
|
1165
1166
|
excel2 = Excel.create(:displayalerts => false)
|
1166
|
-
excel2.DisplayAlerts.should
|
1167
|
-
excel2.displayalerts.should
|
1168
|
-
excel2.Visible.should
|
1169
|
-
excel2.visible.should
|
1167
|
+
excel2.DisplayAlerts.should be false
|
1168
|
+
excel2.displayalerts.should be false
|
1169
|
+
excel2.Visible.should be false
|
1170
|
+
excel2.visible.should be false
|
1170
1171
|
excel3 = Excel.current
|
1171
1172
|
excel3.should === excel
|
1172
|
-
excel3.DisplayAlerts.should
|
1173
|
-
excel3.displayalerts.should
|
1174
|
-
excel3.Visible.should
|
1175
|
-
excel3.visible.should
|
1173
|
+
excel3.DisplayAlerts.should be false
|
1174
|
+
excel3.displayalerts.should be false
|
1175
|
+
excel3.Visible.should be false
|
1176
|
+
excel3.visible.should be false
|
1176
1177
|
excel4 = Excel.current(:displayalerts => true)
|
1177
1178
|
excel4.should === excel
|
1178
|
-
excel4.DisplayAlerts.should
|
1179
|
-
excel4.displayalerts.should
|
1180
|
-
excel4.Visible.should
|
1181
|
-
excel4.visible.should
|
1179
|
+
excel4.DisplayAlerts.should be true
|
1180
|
+
excel4.displayalerts.should be true
|
1181
|
+
excel4.Visible.should be false
|
1182
|
+
excel4.visible.should be false
|
1182
1183
|
excel5 = Excel.current(:displayalerts => false)
|
1183
1184
|
excel5.should === excel
|
1184
|
-
excel5.DisplayAlerts.should
|
1185
|
-
excel5.displayalerts.should
|
1186
|
-
excel5.Visible.should
|
1187
|
-
excel5.visible.should
|
1185
|
+
excel5.DisplayAlerts.should be false
|
1186
|
+
excel5.displayalerts.should be false
|
1187
|
+
excel5.Visible.should be false
|
1188
|
+
excel5.visible.should be false
|
1188
1189
|
end
|
1189
1190
|
|
1190
1191
|
it "should set Excel visible and displayalerts" do
|
1191
1192
|
excel = Excel.new(:reuse => false, :visible => true, :displayalerts => true)
|
1192
|
-
excel.DisplayAlerts.should
|
1193
|
-
excel.displayalerts.should
|
1194
|
-
excel.Visible.should
|
1195
|
-
excel.visible.should
|
1193
|
+
excel.DisplayAlerts.should be true
|
1194
|
+
excel.displayalerts.should be true
|
1195
|
+
excel.Visible.should be true
|
1196
|
+
excel.visible.should be true
|
1196
1197
|
excel6 = Excel.current
|
1197
1198
|
excel6.should === excel
|
1198
|
-
excel6.DisplayAlerts.should
|
1199
|
-
excel6.displayalerts.should
|
1200
|
-
excel6.Visible.should
|
1201
|
-
excel6.visible.should
|
1199
|
+
excel6.DisplayAlerts.should be true
|
1200
|
+
excel6.displayalerts.should be true
|
1201
|
+
excel6.Visible.should be true
|
1202
|
+
excel6.visible.should be true
|
1202
1203
|
excel.displayalerts = false
|
1203
|
-
excel.DisplayAlerts.should
|
1204
|
-
excel.displayalerts.should
|
1205
|
-
excel.Visible.should
|
1206
|
-
excel.visible.should
|
1204
|
+
excel.DisplayAlerts.should be false
|
1205
|
+
excel.displayalerts.should be false
|
1206
|
+
excel.Visible.should be true
|
1207
|
+
excel.visible.should be true
|
1207
1208
|
excel7 = Excel.current
|
1208
1209
|
excel7.should === excel
|
1209
|
-
excel7.DisplayAlerts.should
|
1210
|
-
excel7.displayalerts.should
|
1211
|
-
excel7.Visible.should
|
1212
|
-
excel7.visible.should
|
1210
|
+
excel7.DisplayAlerts.should be false
|
1211
|
+
excel7.displayalerts.should be false
|
1212
|
+
excel7.Visible.should be true
|
1213
|
+
excel7.visible.should be true
|
1213
1214
|
excel2 = Excel.new(:reuse => false, :visible => true, :displayalerts => true)
|
1214
1215
|
excel2.visible = false
|
1215
|
-
excel2.DisplayAlerts.should
|
1216
|
-
excel2.displayalerts.should
|
1217
|
-
excel2.Visible.should
|
1218
|
-
excel2.visible.should
|
1216
|
+
excel2.DisplayAlerts.should be true
|
1217
|
+
excel2.displayalerts.should be true
|
1218
|
+
excel2.Visible.should be false
|
1219
|
+
excel2.visible.should be false
|
1219
1220
|
excel3 = Excel.new(:reuse => false, :visible => true, :displayalerts => false)
|
1220
|
-
excel3.Visible.should
|
1221
|
-
excel3.DisplayAlerts.should
|
1221
|
+
excel3.Visible.should be true
|
1222
|
+
excel3.DisplayAlerts.should be false
|
1222
1223
|
excel3 = Excel.new(:reuse => false, :visible => false, :displayalerts => true)
|
1223
|
-
excel3.Visible.should
|
1224
|
-
excel3.DisplayAlerts.should
|
1224
|
+
excel3.Visible.should be false
|
1225
|
+
excel3.DisplayAlerts.should be true
|
1225
1226
|
excel3 = Excel.new(:reuse => false, :visible => false, :displayalerts => false)
|
1226
|
-
excel3.Visible.should
|
1227
|
-
excel3.DisplayAlerts.should
|
1227
|
+
excel3.Visible.should be false
|
1228
|
+
excel3.DisplayAlerts.should be false
|
1228
1229
|
excel4 = Excel.create(:visible => true, :displayalerts => true)
|
1229
|
-
excel4.DisplayAlerts.should
|
1230
|
-
excel4.displayalerts.should
|
1231
|
-
excel4.Visible.should
|
1232
|
-
excel4.visible.should
|
1230
|
+
excel4.DisplayAlerts.should be true
|
1231
|
+
excel4.displayalerts.should be true
|
1232
|
+
excel4.Visible.should be true
|
1233
|
+
excel4.visible.should be true
|
1233
1234
|
excel5 = Excel.current(:visible => true, :displayalerts => false)
|
1234
1235
|
excel5.should === excel
|
1235
|
-
excel5.DisplayAlerts.should
|
1236
|
-
excel5.displayalerts.should
|
1237
|
-
excel5.Visible.should
|
1238
|
-
excel5.visible.should
|
1236
|
+
excel5.DisplayAlerts.should be false
|
1237
|
+
excel5.displayalerts.should be false
|
1238
|
+
excel5.Visible.should be true
|
1239
|
+
excel5.visible.should be true
|
1239
1240
|
excel6 = Excel.current(:visible => false, :displayalerts => true)
|
1240
1241
|
excel6.should === excel
|
1241
|
-
excel6.DisplayAlerts.should
|
1242
|
-
excel6.displayalerts.should
|
1243
|
-
excel6.Visible.should
|
1244
|
-
excel6.visible.should
|
1242
|
+
excel6.DisplayAlerts.should be true
|
1243
|
+
excel6.displayalerts.should be true
|
1244
|
+
excel6.Visible.should be false
|
1245
|
+
excel6.visible.should be false
|
1245
1246
|
end
|
1246
1247
|
|
1247
1248
|
it "should work with displayalerts == if_visible" do
|
1248
1249
|
excel = Excel.new(:reuse => false, :visible => true, :displayalerts => :if_visible)
|
1249
|
-
excel.Visible.should
|
1250
|
-
excel.DisplayAlerts.should
|
1250
|
+
excel.Visible.should be true
|
1251
|
+
excel.DisplayAlerts.should be true
|
1251
1252
|
excel2 = Excel.new(:reuse => false, :visible => false, :displayalerts => :if_visible)
|
1252
|
-
excel2.Visible.should
|
1253
|
-
excel2.DisplayAlerts.should
|
1253
|
+
excel2.Visible.should be false
|
1254
|
+
excel2.DisplayAlerts.should be false
|
1254
1255
|
excel3 = Excel.new(:reuse => false, :displayalerts => :if_visible)
|
1255
|
-
excel3.Visible.should
|
1256
|
-
excel3.DisplayAlerts.should
|
1256
|
+
excel3.Visible.should be false
|
1257
|
+
excel3.DisplayAlerts.should be false
|
1257
1258
|
excel3.visible = true
|
1258
|
-
excel3.Visible.should
|
1259
|
-
excel3.DisplayAlerts.should
|
1259
|
+
excel3.Visible.should be true
|
1260
|
+
excel3.DisplayAlerts.should be true
|
1260
1261
|
excel3.visible = false
|
1261
|
-
excel3.Visible.should
|
1262
|
-
excel3.DisplayAlerts.should
|
1262
|
+
excel3.Visible.should be false
|
1263
|
+
excel3.DisplayAlerts.should be false
|
1263
1264
|
end
|
1264
1265
|
|
1265
1266
|
it "should keep visible and displayalerts values when reusing Excel" do
|
1266
1267
|
excel = Excel.new(:visible => true)
|
1267
|
-
excel.Visible.should
|
1268
|
-
excel.DisplayAlerts.should
|
1268
|
+
excel.Visible.should be true
|
1269
|
+
excel.DisplayAlerts.should be true
|
1269
1270
|
excel2 = Excel.new(:displayalerts => false)
|
1270
1271
|
excel2.should == excel
|
1271
|
-
excel.Visible.should
|
1272
|
-
excel.DisplayAlerts.should
|
1272
|
+
excel.Visible.should be true
|
1273
|
+
excel.DisplayAlerts.should be false
|
1273
1274
|
end
|
1274
1275
|
|
1275
1276
|
it "should keep displayalerts and visible values when reusing Excel" do
|
1276
1277
|
excel = Excel.new(:displayalerts => true)
|
1277
|
-
excel.Visible.should
|
1278
|
-
excel.DisplayAlerts.should
|
1278
|
+
excel.Visible.should be false
|
1279
|
+
excel.DisplayAlerts.should be true
|
1279
1280
|
excel2 = Excel.new(:visible => true)
|
1280
1281
|
excel2.should == excel
|
1281
|
-
excel.Visible.should
|
1282
|
-
excel.DisplayAlerts.should
|
1282
|
+
excel.Visible.should be true
|
1283
|
+
excel.DisplayAlerts.should be true
|
1283
1284
|
end
|
1284
1285
|
|
1285
1286
|
end
|
@@ -1292,52 +1293,52 @@ module RobustExcelOle
|
|
1292
1293
|
end
|
1293
1294
|
|
1294
1295
|
it "should turn off displayalerts" do
|
1295
|
-
@excel1.DisplayAlerts.should
|
1296
|
+
@excel1.DisplayAlerts.should be true
|
1296
1297
|
begin
|
1297
1298
|
@excel1.with_displayalerts false do
|
1298
|
-
@excel1.DisplayAlerts.should
|
1299
|
+
@excel1.DisplayAlerts.should be false
|
1299
1300
|
raise TestError, "any_error"
|
1300
1301
|
end
|
1301
1302
|
rescue TestError
|
1302
|
-
@excel1.DisplayAlerts.should
|
1303
|
+
@excel1.DisplayAlerts.should be true
|
1303
1304
|
end
|
1304
1305
|
end
|
1305
1306
|
|
1306
1307
|
it "should turn on displayalerts" do
|
1307
|
-
@excel2.DisplayAlerts.should
|
1308
|
+
@excel2.DisplayAlerts.should be false
|
1308
1309
|
begin
|
1309
1310
|
@excel1.with_displayalerts true do
|
1310
|
-
@excel1.DisplayAlerts.should
|
1311
|
+
@excel1.DisplayAlerts.should be true
|
1311
1312
|
raise TestError, "any_error"
|
1312
1313
|
end
|
1313
1314
|
rescue TestError
|
1314
|
-
@excel2.DisplayAlerts.should
|
1315
|
+
@excel2.DisplayAlerts.should be false
|
1315
1316
|
end
|
1316
1317
|
end
|
1317
1318
|
|
1318
1319
|
it "should set displayalerts to :if_visible" do
|
1319
|
-
@excel1.DisplayAlerts.should
|
1320
|
+
@excel1.DisplayAlerts.should be true
|
1320
1321
|
begin
|
1321
1322
|
@excel1.with_displayalerts :if_visible do
|
1322
|
-
@excel1.DisplayAlerts.should
|
1323
|
-
@excel1.Visible.should
|
1323
|
+
@excel1.DisplayAlerts.should be false
|
1324
|
+
@excel1.Visible.should be false
|
1324
1325
|
raise TestError, "any_error"
|
1325
1326
|
end
|
1326
1327
|
rescue TestError
|
1327
|
-
@excel1.DisplayAlerts.should
|
1328
|
+
@excel1.DisplayAlerts.should be true
|
1328
1329
|
end
|
1329
1330
|
end
|
1330
1331
|
|
1331
1332
|
it "should set displayalerts to :if_visible" do
|
1332
|
-
@excel3.DisplayAlerts.should
|
1333
|
+
@excel3.DisplayAlerts.should be false
|
1333
1334
|
begin
|
1334
1335
|
@excel3.with_displayalerts :if_visible do
|
1335
|
-
@excel3.DisplayAlerts.should
|
1336
|
-
@excel3.Visible.should
|
1336
|
+
@excel3.DisplayAlerts.should be true
|
1337
|
+
@excel3.Visible.should be true
|
1337
1338
|
raise TestError, "any_error"
|
1338
1339
|
end
|
1339
1340
|
rescue TestError
|
1340
|
-
@excel3.DisplayAlerts.should
|
1341
|
+
@excel3.DisplayAlerts.should be false
|
1341
1342
|
end
|
1342
1343
|
end
|
1343
1344
|
|
@@ -1347,13 +1348,13 @@ module RobustExcelOle
|
|
1347
1348
|
|
1348
1349
|
it "should set screen updating" do
|
1349
1350
|
excel1 = Excel.new
|
1350
|
-
excel1.ScreenUpdating.should
|
1351
|
+
excel1.ScreenUpdating.should be true
|
1351
1352
|
excel2 = Excel.create(:screenupdating => false)
|
1352
|
-
excel2.ScreenUpdating.should
|
1353
|
+
excel2.ScreenUpdating.should be false
|
1353
1354
|
excel3 = Excel.new
|
1354
|
-
excel3.ScreenUpdating.should
|
1355
|
+
excel3.ScreenUpdating.should be true
|
1355
1356
|
excel4 = Excel.new(:screenupdating => false)
|
1356
|
-
excel4.ScreenUpdating.should
|
1357
|
+
excel4.ScreenUpdating.should be false
|
1357
1358
|
end
|
1358
1359
|
|
1359
1360
|
end
|
@@ -1410,19 +1411,19 @@ module RobustExcelOle
|
|
1410
1411
|
@excel1.with_calculation(:manual) do
|
1411
1412
|
@excel1.calculation.should == :manual
|
1412
1413
|
@excel1.Calculation.should == -4135
|
1413
|
-
@excel1.CalculateBeforeSave.should
|
1414
|
-
book.Saved.should
|
1414
|
+
@excel1.CalculateBeforeSave.should be false
|
1415
|
+
book.Saved.should be true
|
1415
1416
|
end
|
1416
1417
|
@excel1.Calculation.should == old_calculation_mode
|
1417
|
-
@excel1.CalculateBeforeSave.should
|
1418
|
+
@excel1.CalculateBeforeSave.should be false
|
1418
1419
|
@excel1.with_calculation(:automatic) do
|
1419
1420
|
@excel1.calculation.should == :automatic
|
1420
1421
|
@excel1.Calculation.should == -4105
|
1421
|
-
@excel1.CalculateBeforeSave.should
|
1422
|
-
book.Saved.should
|
1422
|
+
@excel1.CalculateBeforeSave.should be false
|
1423
|
+
book.Saved.should be false
|
1423
1424
|
end
|
1424
1425
|
@excel1.Calculation.should == old_calculation_mode
|
1425
|
-
@excel1.CalculateBeforeSave.should
|
1426
|
+
@excel1.CalculateBeforeSave.should be false
|
1426
1427
|
end
|
1427
1428
|
|
1428
1429
|
it "should set calculation mode to manual with workbook" do
|
@@ -1432,8 +1433,8 @@ module RobustExcelOle
|
|
1432
1433
|
@excel1.calculation = :manual
|
1433
1434
|
@excel1.calculation.should == :manual
|
1434
1435
|
@excel1.Calculation.should == -4135
|
1435
|
-
@excel1.CalculateBeforeSave.should
|
1436
|
-
book.Saved.should
|
1436
|
+
@excel1.CalculateBeforeSave.should be false
|
1437
|
+
book.Saved.should be true
|
1437
1438
|
end
|
1438
1439
|
|
1439
1440
|
it "should set calculation mode to automatic with workbook" do
|
@@ -1442,8 +1443,8 @@ module RobustExcelOle
|
|
1442
1443
|
@excel1.calculation = :automatic
|
1443
1444
|
@excel1.calculation.should == :automatic
|
1444
1445
|
@excel1.Calculation.should == -4105
|
1445
|
-
@excel1.CalculateBeforeSave.should
|
1446
|
-
book.Saved.should
|
1446
|
+
@excel1.CalculateBeforeSave.should be false
|
1447
|
+
book.Saved.should be false
|
1447
1448
|
end
|
1448
1449
|
|
1449
1450
|
it "should set Calculation without workbooks" do
|
@@ -1477,7 +1478,8 @@ module RobustExcelOle
|
|
1477
1478
|
end
|
1478
1479
|
|
1479
1480
|
it "should raise WIN32OLERuntimeError" do
|
1480
|
-
expect{ @excel1.NonexistingMethod }.to raise_error
|
1481
|
+
expect{ @excel1.NonexistingMethod }.to raise_error
|
1482
|
+
#(VBAMethodMissingError, /unknown VBA property or method :NonexistingMethod/)
|
1481
1483
|
end
|
1482
1484
|
|
1483
1485
|
it "should raise NoMethodError for uncapitalized methods" do
|
@@ -1499,9 +1501,9 @@ module RobustExcelOle
|
|
1499
1501
|
|
1500
1502
|
it "should set options in the Excel instance" do
|
1501
1503
|
@excel.for_this_instance(:displayalerts => true, :visible => true, :screenupdating => true, :calculaiton => :manual)
|
1502
|
-
@excel.DisplayAlerts.should
|
1503
|
-
@excel.Visible.should
|
1504
|
-
@excel.ScreenUpdating.should
|
1504
|
+
@excel.DisplayAlerts.should be true
|
1505
|
+
@excel.Visible.should be true
|
1506
|
+
@excel.ScreenUpdating.should be true
|
1505
1507
|
book = Book.open(@simple_file)
|
1506
1508
|
@excel.Calculation.should == -4135
|
1507
1509
|
book.close
|
@@ -1521,11 +1523,11 @@ module RobustExcelOle
|
|
1521
1523
|
it "should set options to true for a workbook" do
|
1522
1524
|
book1 = Book.open(@simple_file)
|
1523
1525
|
book1.excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
|
1524
|
-
book1.excel.Visible.should
|
1525
|
-
book1.Windows(book1.Name).Visible.should
|
1526
|
-
book1.visible.should
|
1527
|
-
book1.ReadOnly.should
|
1528
|
-
book1.CheckCompatibility.should
|
1526
|
+
book1.excel.Visible.should be true
|
1527
|
+
book1.Windows(book1.Name).Visible.should be true
|
1528
|
+
book1.visible.should be true
|
1529
|
+
book1.ReadOnly.should be true
|
1530
|
+
book1.CheckCompatibility.should be true
|
1529
1531
|
end
|
1530
1532
|
|
1531
1533
|
it "should set options for two workbooks" do
|
@@ -1533,23 +1535,23 @@ module RobustExcelOle
|
|
1533
1535
|
book2 = Book.open(@different_file)
|
1534
1536
|
excel = book1.excel
|
1535
1537
|
excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
|
1536
|
-
excel.Visible.should
|
1537
|
-
book1.Windows(book1.Name).Visible.should
|
1538
|
-
book1.visible.should
|
1539
|
-
book1.ReadOnly.should
|
1540
|
-
book1.CheckCompatibility.should
|
1541
|
-
book2.Windows(book2.Name).Visible.should
|
1542
|
-
book2.visible.should
|
1543
|
-
book2.ReadOnly.should
|
1544
|
-
book2.CheckCompatibility.should
|
1538
|
+
excel.Visible.should be true
|
1539
|
+
book1.Windows(book1.Name).Visible.should be true
|
1540
|
+
book1.visible.should be true
|
1541
|
+
book1.ReadOnly.should be true
|
1542
|
+
book1.CheckCompatibility.should be true
|
1543
|
+
book2.Windows(book2.Name).Visible.should be true
|
1544
|
+
book2.visible.should be true
|
1545
|
+
book2.ReadOnly.should be true
|
1546
|
+
book2.CheckCompatibility.should be true
|
1545
1547
|
excel.for_all_workbooks(:visible => false, :read_only => false, :check_compatibility => false)
|
1546
|
-
excel.Visible.should
|
1547
|
-
book1.Windows(book1.Name).Visible.should
|
1548
|
-
book1.visible.should
|
1549
|
-
book2.Windows(book2.Name).Visible.should
|
1550
|
-
book2.visible.should
|
1551
|
-
book2.ReadOnly.should
|
1552
|
-
book2.CheckCompatibility.should
|
1548
|
+
excel.Visible.should be true
|
1549
|
+
book1.Windows(book1.Name).Visible.should be false
|
1550
|
+
book1.visible.should be false
|
1551
|
+
book2.Windows(book2.Name).Visible.should be false
|
1552
|
+
book2.visible.should be false
|
1553
|
+
book2.ReadOnly.should be false
|
1554
|
+
book2.CheckCompatibility.should be false
|
1553
1555
|
end
|
1554
1556
|
|
1555
1557
|
end
|
@@ -1652,8 +1654,8 @@ module RobustExcelOle
|
|
1652
1654
|
workbook.should be_a WIN32OLE
|
1653
1655
|
workbook.Name.should == File.basename(@file_name)
|
1654
1656
|
workbook.FullName.should == General::absolute_path(@file_name)
|
1655
|
-
workbook.Saved.should
|
1656
|
-
workbook.ReadOnly.should
|
1657
|
+
workbook.Saved.should be true
|
1658
|
+
workbook.ReadOnly.should be false
|
1657
1659
|
workbook.Sheets.Count.should == 3
|
1658
1660
|
workbooks = @excel1.Workbooks
|
1659
1661
|
workbooks.Count.should == 1
|
@@ -1664,8 +1666,8 @@ module RobustExcelOle
|
|
1664
1666
|
workbook.should be_a WIN32OLE
|
1665
1667
|
workbook.Name.should == File.basename(@file_name)
|
1666
1668
|
workbook.FullName.should == General::absolute_path(@file_name)
|
1667
|
-
workbook.Saved.should
|
1668
|
-
workbook.ReadOnly.should
|
1669
|
+
workbook.Saved.should be true
|
1670
|
+
workbook.ReadOnly.should be false
|
1669
1671
|
workbook.Sheets.Count.should == 3
|
1670
1672
|
workbooks = @excel1.Workbooks
|
1671
1673
|
workbooks.Count.should == 1
|
@@ -1681,8 +1683,8 @@ module RobustExcelOle
|
|
1681
1683
|
workbook.should be_a WIN32OLE
|
1682
1684
|
workbook.Name.should == File.basename(@file_name)
|
1683
1685
|
workbook.FullName.should == General::absolute_path(@file_name)
|
1684
|
-
workbook.Saved.should
|
1685
|
-
workbook.ReadOnly.should
|
1686
|
+
workbook.Saved.should be true
|
1687
|
+
workbook.ReadOnly.should be false
|
1686
1688
|
workbook.Sheets.Count.should == 3
|
1687
1689
|
workbooks = @excel1.Workbooks
|
1688
1690
|
workbooks.Count.should == 2
|