robust_excel_ole 1.10 → 1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ describe Workbook do
25
25
  @simple_file_other_path = @dir + '/more_data/workbook.xls'
26
26
  @another_simple_file = @dir + '/another_workbook.xls'
27
27
  @linked_file = @dir + '/workbook_linked.xlsm'
28
- @simple_file_xlsm = @dir + '/workbook.xls'
28
+ @simple_file_xlsm = @dir + '/workbook.xlsm'
29
29
  @simple_file_xlsx = @dir + '/workbook.xlsx'
30
30
  @simple_file1 = @simple_file
31
31
  end
@@ -296,6 +296,46 @@ describe Workbook do
296
296
 
297
297
  end
298
298
 
299
+ describe "excels number" do
300
+
301
+ it "should open one excel instance and workbook should be closed" do
302
+ Workbook.unobtrusively(@simple_file1){ |book| nil }
303
+ Excel.excels_number.should == 1
304
+ end
305
+
306
+ end
307
+
308
+ describe "closed workbook" do
309
+
310
+ it "should close the workbook by default" do
311
+ Workbook.unobtrusively(@simple_file1){ |book| nil}
312
+ Excel.current.Workbooks.Count.should == 0
313
+ end
314
+
315
+ end
316
+
317
+ describe "connecting to unknown workbooks" do
318
+
319
+ context "with one unknown workbook" do
320
+
321
+ before do
322
+ ole_e1 = WIN32OLE.new('Excel.Application')
323
+ ws = ole_e1.Workbooks
324
+ abs_filename = General.absolute_path(@simple_file1).tr('/','\\')
325
+ @ole_wb = ws.Open(abs_filename)
326
+ end
327
+
328
+ it "should connect to an unknown workbook" do
329
+ Workbook.unobtrusively(@simple_file1) do |book|
330
+ book.filename.should == @simple_file1
331
+ book.excel.ole_excel.Hwnd.should == @ole_wb.Application.Hwnd
332
+ end
333
+ end
334
+
335
+ end
336
+
337
+ end
338
+
299
339
  describe "writability" do
300
340
 
301
341
  context "with no book" do
@@ -102,6 +102,20 @@ describe Worksheet do
102
102
  end
103
103
 
104
104
  end
105
+
106
+ describe "==" do
107
+
108
+ it "should return true for identical worksheets" do
109
+ sheet2 = @book.sheet(1)
110
+ @sheet.should == sheet2
111
+ end
112
+
113
+ it "should return false for non-identical worksheets" do
114
+ sheet2 = @book.sheet(2)
115
+ @sheet.should_not == sheet2
116
+ end
117
+
118
+ end
105
119
 
106
120
  describe "access sheet name" do
107
121
  describe "#name" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robust_excel_ole
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.10'
4
+ version: '1.11'
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-13 00:00:00.000000000 Z
11
+ date: 2019-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec