robust_excel_ole 1.16 → 1.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -384,7 +384,7 @@ describe Workbook do
384
384
  book.visible.should be false
385
385
  book.writable.should be true
386
386
  book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
387
- @new_value = book.sheet(1)[1,1].value
387
+ @new_value = book.sheet(1)[1,1].Value
388
388
  book.Saved.should be false
389
389
  end
390
390
  ole_wb = WIN32OLE.connect(@abs_filename)
@@ -393,8 +393,8 @@ describe Workbook do
393
393
  ole_wb.ReadOnly.should be false
394
394
  ole_wb.Close
395
395
  book2 = Workbook.open(@simple_file1)
396
- book2.sheet(1)[1,1].value.should_not == @old_value
397
- book2.sheet(1)[1,1].value.should == @new_value
396
+ book2.sheet(1)[1,1].Value.should_not == @old_value
397
+ book2.sheet(1)[1,1].Value.should == @new_value
398
398
  end
399
399
 
400
400
  it "should modify and remain saved-status and not save the new value when writable => false" do
@@ -403,7 +403,7 @@ describe Workbook do
403
403
  book.visible.should be false
404
404
  book.writable.should be true
405
405
  book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
406
- @new_value = book.sheet(1)[1,1].value
406
+ @new_value = book.sheet(1)[1,1].Value
407
407
  book.Saved.should be false
408
408
  end
409
409
  ole_wb = WIN32OLE.connect(@abs_filename)
@@ -412,8 +412,8 @@ describe Workbook do
412
412
  ole_wb.ReadOnly.should be false
413
413
  ole_wb.Close
414
414
  book2 = Workbook.open(@simple_file1)
415
- book2.sheet(1)[1,1].value.should == @old_value
416
- book2.sheet(1)[1,1].value.should_not == @new_value
415
+ book2.sheet(1)[1,1].Value.should == @old_value
416
+ book2.sheet(1)[1,1].Value.should_not == @new_value
417
417
  end
418
418
 
419
419
  end
@@ -518,8 +518,8 @@ describe Workbook do
518
518
  ole_wb.ReadOnly.should be false
519
519
  Excel.kill_all
520
520
  book2 = Workbook.open(@simple_file1)
521
- book2.sheet(1)[1,1].value.should_not == @old_value
522
- book2.sheet(1)[1,1].value.should == @new_value
521
+ book2.sheet(1)[1,1].Value.should_not == @old_value
522
+ book2.sheet(1)[1,1].Value.should == @new_value
523
523
  end
524
524
 
525
525
  it "should not write with :writable => false" do
@@ -539,8 +539,8 @@ describe Workbook do
539
539
  ole_wb.ReadOnly.should be false
540
540
  Excel.kill_all
541
541
  book2 = Workbook.open(@simple_file1)
542
- book2.sheet(1)[1,1].value.should == @old_value
543
- book2.sheet(1)[1,1].value.should_not == @new_value
542
+ book2.sheet(1)[1,1].Value.should == @old_value
543
+ book2.sheet(1)[1,1].Value.should_not == @new_value
544
544
  end
545
545
 
546
546
  end
@@ -596,8 +596,8 @@ describe Workbook do
596
596
  ole_wb.ReadOnly.should be true
597
597
  ole_wb.Close
598
598
  book2 = Workbook.open(@simple_file1)
599
- book2.sheet(1)[1,1].value.should == @old_value
600
- book2.sheet(1)[1,1].value.should_not == @new_value
599
+ book2.sheet(1)[1,1].Value.should == @old_value
600
+ book2.sheet(1)[1,1].Value.should_not == @new_value
601
601
  end
602
602
 
603
603
  it "should remain read-only when modifying" do
@@ -614,8 +614,8 @@ describe Workbook do
614
614
  ole_wb.ReadOnly.should be true
615
615
  ole_wb.Close
616
616
  book2 = Workbook.open(@simple_file1)
617
- book2.sheet(1)[1,1].value.should_not == @old_value
618
- book2.sheet(1)[1,1].value.should == @new_value
617
+ book2.sheet(1)[1,1].Value.should_not == @old_value
618
+ book2.sheet(1)[1,1].Value.should == @new_value
619
619
  end
620
620
 
621
621
  it "should remain read-only when modifying" do
@@ -632,8 +632,8 @@ describe Workbook do
632
632
  ole_wb.ReadOnly.should be true
633
633
  ole_wb.Close
634
634
  book2 = Workbook.open(@simple_file1)
635
- book2.sheet(1)[1,1].value.should_not == @old_value
636
- book2.sheet(1)[1,1].value.should == @new_value
635
+ book2.sheet(1)[1,1].Value.should_not == @old_value
636
+ book2.sheet(1)[1,1].Value.should == @new_value
637
637
  end
638
638
 
639
639
  it "should remain read-only when modifying and not save changes, when :writable => false" do
@@ -650,8 +650,8 @@ describe Workbook do
650
650
  ole_wb.ReadOnly.should be true
651
651
  ole_wb.Close
652
652
  book2 = Workbook.open(@simple_file1)
653
- book2.sheet(1)[1,1].value.should == @old_value
654
- book2.sheet(1)[1,1].value.should_not == @new_value
653
+ book2.sheet(1)[1,1].Value.should == @old_value
654
+ book2.sheet(1)[1,1].Value.should_not == @new_value
655
655
  end
656
656
 
657
657
  it "should remain read-only when modifying and not save changes, when :writable => false" do
@@ -668,8 +668,8 @@ describe Workbook do
668
668
  ole_wb.ReadOnly.should be true
669
669
  ole_wb.Close
670
670
  book2 = Workbook.open(@simple_file1)
671
- book2.sheet(1)[1,1].value.should == @old_value
672
- book2.sheet(1)[1,1].value.should_not == @new_value
671
+ book2.sheet(1)[1,1].Value.should == @old_value
672
+ book2.sheet(1)[1,1].Value.should_not == @new_value
673
673
  end
674
674
 
675
675
 
@@ -687,8 +687,8 @@ describe Workbook do
687
687
  ole_wb.ReadOnly.should be true
688
688
  ole_wb.Close
689
689
  book2 = Workbook.open(@simple_file1)
690
- book2.sheet(1)[1,1].value.should == @old_value
691
- book2.sheet(1)[1,1].value.should_not == @new_value
690
+ book2.sheet(1)[1,1].Value.should == @old_value
691
+ book2.sheet(1)[1,1].Value.should_not == @new_value
692
692
  end
693
693
 
694
694
  it "should remain read-only when modifying and not save changes, even if :writable => true" do
@@ -705,8 +705,8 @@ describe Workbook do
705
705
  ole_wb.ReadOnly.should be true
706
706
  ole_wb.Close
707
707
  book2 = Workbook.open(@simple_file1)
708
- book2.sheet(1)[1,1].value.should == @old_value
709
- book2.sheet(1)[1,1].value.should_not == @new_value
708
+ book2.sheet(1)[1,1].Value.should == @old_value
709
+ book2.sheet(1)[1,1].Value.should_not == @new_value
710
710
  end
711
711
 
712
712
  it "should remain read-only when modifying and not save changes, when :writable => false" do
@@ -723,8 +723,8 @@ describe Workbook do
723
723
  ole_wb.ReadOnly.should be true
724
724
  Excel.kill_all
725
725
  book2 = Workbook.open(@simple_file1)
726
- book2.sheet(1)[1,1].value.should == @old_value
727
- book2.sheet(1)[1,1].value.should_not == @new_value
726
+ book2.sheet(1)[1,1].Value.should == @old_value
727
+ book2.sheet(1)[1,1].Value.should_not == @new_value
728
728
  end
729
729
 
730
730
 
@@ -935,7 +935,7 @@ describe Workbook do
935
935
  book.ReadOnly.should be true
936
936
  book.should == @book
937
937
  book.filename.should == @book.filename
938
- book.excel.should == @book.excel
938
+ book.excel.should_not == @book.excel
939
939
  book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
940
940
  end
941
941
  }.to raise_error(WorkbookReadOnly)
@@ -1013,7 +1013,7 @@ describe Workbook do
1013
1013
  book.Readonly.should be false
1014
1014
  book.should == @book
1015
1015
  book.filename.should == @book.filename
1016
- book.excel.should == @book.excel
1016
+ book.excel.should_not == @book.excel
1017
1017
  book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1018
1018
  end
1019
1019
  @book.close
@@ -1026,7 +1026,7 @@ describe Workbook do
1026
1026
  book.Readonly.should be false
1027
1027
  book.should == @book
1028
1028
  book.filename.should == @book.filename
1029
- book.excel.should == @book.excel
1029
+ book.excel.should_not == @book.excel
1030
1030
  book.sheet(1)[1,1] = book.sheet(1)[1,1].Value == "foo" ? "bar" : "foo"
1031
1031
  end
1032
1032
  @book.close
@@ -1612,7 +1612,7 @@ describe Workbook do
1612
1612
  Workbook.unobtrusively(@simple_file) do |book|
1613
1613
  book.should be_a Workbook
1614
1614
  book.excel.Visible.should be false
1615
- book.CheckCompatibility.should be false
1615
+ book.CheckCompatibility.should be true
1616
1616
  book.ReadOnly.should be false
1617
1617
  end
1618
1618
  end
@@ -1677,7 +1677,7 @@ describe Workbook do
1677
1677
  expect{
1678
1678
  Workbook.unobtrusively(@simple_file, :if_closed => :invalid_option) do |book|
1679
1679
  end
1680
- }.to raise_error(TypeREOError, "given object is neither an Excel, a Workbook, nor a Win32ole")
1680
+ }.to raise_error(TypeREOError, "provided Excel option value is neither an Excel object nor a valid option")
1681
1681
  end
1682
1682
 
1683
1683
  end
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.16'
4
+ version: '1.17'
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -85,7 +85,8 @@ files:
85
85
  - lib/jreo_console.rb
86
86
  - lib/reo_console.rb
87
87
  - lib/robust_excel_ole.rb
88
- - lib/robust_excel_ole/address.rb
88
+ - lib/robust_excel_ole/address_tool.rb
89
+ - lib/robust_excel_ole/base.rb
89
90
  - lib/robust_excel_ole/bookstore.rb
90
91
  - lib/robust_excel_ole/cell.rb
91
92
  - lib/robust_excel_ole/cygwin.rb
@@ -93,7 +94,6 @@ files:
93
94
  - lib/robust_excel_ole/general.rb
94
95
  - lib/robust_excel_ole/range.rb
95
96
  - lib/robust_excel_ole/range_owners.rb
96
- - lib/robust_excel_ole/reo_common.rb
97
97
  - lib/robust_excel_ole/robustexcelole.sublime-project
98
98
  - lib/robust_excel_ole/robustexcelole.sublime-workspace
99
99
  - lib/robust_excel_ole/version.rb
@@ -102,7 +102,8 @@ files:
102
102
  - lib/spec_helper.rb
103
103
  - reo.bat
104
104
  - robust_excel_ole.gemspec
105
- - spec/address_spec.rb
105
+ - spec/address_tool_spec.rb
106
+ - spec/base_spec.rb
106
107
  - spec/bookstore_spec.rb
107
108
  - spec/cell_spec.rb
108
109
  - spec/cygwin_spec.rb
@@ -126,7 +127,6 @@ files:
126
127
  - spec/helpers/create_temporary_dir.rb
127
128
  - spec/helpers/key_sender.rb
128
129
  - spec/range_spec.rb
129
- - spec/reo_common_spec.rb
130
130
  - spec/spec_helper.rb
131
131
  - spec/workbook_spec.rb
132
132
  - spec/workbook_specs/workbook_all_spec.rb
data/spec/address_spec.rb DELETED
@@ -1,174 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.join(File.dirname(__FILE__), './spec_helper')
4
- require File.expand_path( '../../lib/robust_excel_ole/reo_common', __FILE__)
5
-
6
- $VERBOSE = nil
7
-
8
- include General
9
- include RobustExcelOle
10
-
11
- module RobustExcelOle
12
-
13
- describe Address do
14
-
15
- before(:all) do
16
- excel = Excel.new(:reuse => true)
17
- open_books = excel == nil ? 0 : excel.Workbooks.Count
18
- puts "*** open books *** : #{open_books}" if open_books > 0
19
- Excel.kill_all
20
- @dir = create_tmpdir
21
- @simple_file = @dir + '/workbook.xls'
22
- @book = Workbook.open(@simple_file)
23
- end
24
-
25
- after(:all) do
26
- @book.close
27
- end
28
-
29
- it "should transform relative r1c1-reference into r1c1-format" do
30
- Address.r1c1("Z1S[2]:Z[-1]S4").should == "Z1S(2):Z(-1)S4"
31
- Address.r1c1("Z[1]S2:Z3S[4]").should == "Z(1)S2:Z3S(4)"
32
- Address.r1c1("Z1S[2]").should == "Z1S(2)"
33
- Address.r1c1("Z[-1]S4").should == "Z(-1)S4"
34
- Address.r1c1("Z[3]").should == "Z(3)"
35
- Address.r1c1("S[-2]").should == "S(-2)"
36
- end
37
-
38
- # test for 1.8.6
39
- it "should transform relative int_range-reference into r1c1-format" do
40
- Address.r1c1([1..2,[3]..4]).should == "Z1S(3):Z2S4"
41
- Address.r1c1([[1]..2,3..4]).should == "Z(1)S3:Z2S4"
42
- Address.r1c1([[1]..2,nil]).should == "Z(1):Z2"
43
- Address.r1c1([nil,[1]..2]).should == "S(1):S2"
44
- Address.r1c1([nil,[1]]).should == "S(1):S(1)"
45
- end
46
-
47
- it "should transform relative int_range-reference into r1c1-format" do
48
- Address.r1c1([1..[-2],[3]..4]).should == "Z1S(3):Z(-2)S4"
49
- Address.r1c1([[1]..2,3..[4]]).should == "Z(1)S3:Z2S(4)"
50
- Address.r1c1([1..[-2],nil]).should == "Z1:Z(-2)"
51
- Address.r1c1([nil,[-1]..2]).should == "S(-1):S2"
52
- Address.r1c1([[3]..[3],nil]).should == "Z(3):Z(3)"
53
- Address.r1c1([nil,[-2]..[-2]]).should == "S(-2):S(-2)"
54
- Address.r1c1([[3],nil]).should == "Z(3):Z(3)"
55
- end
56
-
57
- it "should transform relative r1c1-reference into r1c1-format" do
58
- Address.int_range("Z1S[2]:Z[3]S4").should == [1..[3],[2]..4]
59
- Address.int_range("Z[1]S2:Z3S[4]").should == [[1]..3,2..[4]]
60
- Address.int_range("Z1S[2]").should == [1..1,[2]..[2]]
61
- Address.int_range("Z[3]S4").should == [[3]..[3],4..4]
62
- end
63
-
64
- it "should transform a1-format" do
65
- Address.a1("A2").should == "A2"
66
- Address.r1c1("A2").should == "Z2S1:Z2S1"
67
- Address.int_range("A2").should == [2..2,1..1]
68
- end
69
-
70
- it "should transform several-letter-a1-format" do
71
- Address.a1("ABO15").should == "ABO15"
72
- Address.r1c1("ABO15").should == "Z15S743:Z15S743"
73
- Address.int_range("ABO15").should == [15..15,743..743]
74
- end
75
-
76
- it "should transform complex a1-format" do
77
- Address.a1("A2:B3").should == "A2:B3"
78
- Address.r1c1("A2:B3").should == "Z2S1:Z3S2"
79
- Address.int_range("A2:B3").should == [2..3,1..2]
80
- Address.a1("S1:DP2").should == "S1:DP2"
81
- Address.r1c1("S1:DP2").should == "Z1S19:Z2S120"
82
- Address.int_range("S1:DP2").should == [1..2,19..120]
83
- end
84
-
85
- it "should transform infinite a1-format" do
86
- Address.a1("A:B").should == "A:B"
87
- Address.r1c1("A:B").should == "S1:S2"
88
- Address.int_range("A:B").should == [nil,1..2]
89
- Address.a1("1:3").should == "1:3"
90
- Address.r1c1("1:3").should == "Z1:Z3"
91
- Address.int_range("1:3").should == [1..3,nil]
92
- Address.a1("B").should == "B"
93
- Address.r1c1("B").should == "S2:S2"
94
- Address.int_range("B").should == [nil,2..2]
95
- Address.a1("3").should == "3"
96
- Address.r1c1("3").should == "Z3:Z3"
97
- Address.int_range("3").should == [3..3,nil]
98
- end
99
-
100
- it "should transform r1c1-format" do
101
- Address.r1c1("Z2S1").should == "Z2S1"
102
- Address.int_range("Z2S1").should == [2..2,1..1]
103
- expect{
104
- Address.a1("Z2S1")
105
- }.to raise_error(NotImplementedREOError)
106
- end
107
-
108
- it "should transform complex r1c1-format" do
109
- Address.r1c1("Z2S1:Z3S2").should == "Z2S1:Z3S2"
110
- Address.int_range("Z2S1:Z3S2").should == [2..3,1..2]
111
- end
112
-
113
- it "should transform int_range format" do
114
- Address.int_range([2..2,1..1]).should == [2..2,1..1]
115
- Address.r1c1([2..2,1..1]).should == "Z2S1:Z2S1"
116
- expect{
117
- Address.a1([2..2,1..1])
118
- }.to raise_error(NotImplementedREOError)
119
- end
120
-
121
- it "should transform simple int_range format" do
122
- Address.int_range([2,1]).should == [2..2,1..1]
123
- Address.r1c1([2,1]).should == "Z2S1:Z2S1"
124
- end
125
-
126
- it "should transform complex int_range format" do
127
- Address.int_range([2,"A"]).should == [2..2,1..1]
128
- Address.r1c1([2,"A"]).should == "Z2S1:Z2S1"
129
- Address.int_range([2,"A".."B"]).should == [2..2,1..2]
130
- Address.r1c1([2,"A".."B"]).should == "Z2S1:Z2S2"
131
- Address.int_range([1..2,"C"]).should == [1..2,3..3]
132
- Address.r1c1([1..2,"C"]).should == "Z1S3:Z2S3"
133
- Address.int_range([1..2,"C".."E"]).should == [1..2,3..5]
134
- Address.r1c1([1..2,"C".."E"]).should == "Z1S3:Z2S5"
135
- Address.int_range([2,3..5]).should == [2..2,3..5]
136
- Address.r1c1([2,3..5]).should == "Z2S3:Z2S5"
137
- Address.int_range([1..2,3..5]).should == [1..2,3..5]
138
- Address.r1c1([1..2,3..5]).should == "Z1S3:Z2S5"
139
- end
140
-
141
- it "should transform infinite int_range format" do
142
- Address.int_range([nil,1..2]).should == [nil,1..2]
143
- Address.r1c1([nil,1..2]).should == "S1:S2"
144
- Address.int_range([1..3,nil]).should == [1..3,nil]
145
- Address.r1c1([1..3,nil]).should == "Z1:Z3"
146
- Address.int_range([nil,2]).should == [nil,2..2]
147
- Address.r1c1([nil,2]).should == "S2:S2"
148
- Address.int_range([3,nil]).should == [3..3,nil]
149
- Address.r1c1([3,nil]).should == "Z3:Z3"
150
- end
151
-
152
- it "should raise an error" do
153
- expect{
154
- Address.a1("1A")
155
- }.to raise_error(AddressInvalid, /format not correct/)
156
- expect{
157
- Address.r1c1("A1B")
158
- }.to raise_error(AddressInvalid, /format not correct/)
159
- #expect{
160
- # Address.int_range(["A".."B","C".."D"])
161
- #}.to raise_error(AddressInvalid, /format not correct/)
162
- #expect{
163
- # Address.int_range(["A".."B",1..2])
164
- #}.to raise_error(AddressInvalid, /format not correct/)
165
- #expect{
166
- # Address.int_range(["A".."B",nil])
167
- #}.to raise_error(AddressInvalid, /format not correct/)
168
- expect{
169
- Address.int_range(["A",1,2])
170
- }.to raise_error(AddressInvalid, /more than two components/)
171
- end
172
-
173
- end
174
- end