robust_excel_ole 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -251,7 +251,7 @@ describe Book do
251
251
  expect{
252
252
  Book.unobtrusively(@simple_file, :if_closed => :invalid_option) do |book|
253
253
  end
254
- }.to raise_error(TypeErrorREO, "given object is neither an Excel, a Workbook, nor a Win32ole")
254
+ }.to raise_error(TypeREOError, "given object is neither an Excel, a Workbook, nor a Win32ole")
255
255
  end
256
256
 
257
257
  end
Binary file
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
@@ -714,7 +714,7 @@ module RobustExcelOle
714
714
  @key_sender.puts "{left}{enter}"
715
715
  expect{
716
716
  @excel.close(:if_unsaved => :alert)
717
- }.to raise_error(ExcelError, "user canceled or runtime error")
717
+ }.to raise_error(ExcelREOError, "user canceled or runtime error")
718
718
  end
719
719
  end
720
720
  end
@@ -984,54 +984,7 @@ module RobustExcelOle
984
984
 
985
985
  end
986
986
 
987
- context "workbooks_visible" do
988
-
989
- it "should not raise an error for an empty Excel instance" do
990
- excel = Excel.create
991
- expect{
992
- excel.workbooks_visible = true
993
- }.to_not raise_error
994
- end
995
-
996
- it "should make visible a workbook" do
997
- book1 = Book.open(@simple_file)
998
- book1.excel.workbooks_visible = true
999
- book1.excel.Visible.should be_true
1000
- book1.Windows(book1.Name).Visible.should be_true
1001
- book1.visible.should be_true
1002
- end
1003
-
1004
- it "should make visible and invisible two workbooks" do
1005
- book1 = Book.open(@simple_file)
1006
- book2 = Book.open(@different_file)
1007
- excel = book1.excel
1008
- excel.workbooks_visible = true
1009
- excel.Visible.should be_true
1010
- book1.Windows(book1.Name).Visible.should be_true
1011
- book1.visible.should be_true
1012
- book2.Windows(book2.Name).Visible.should be_true
1013
- book2.visible.should be_true
1014
- excel.workbooks_visible = false
1015
- excel.Visible.should be_true
1016
- book1.Windows(book1.Name).Visible.should be_false
1017
- book1.visible.should be_false
1018
- book2.Windows(book2.Name).Visible.should be_false
1019
- book2.visible.should be_false
1020
- end
1021
-
1022
- it "should make visible all workbooks" do
1023
- book1 = Book.open(@simple_file, :visible => true)
1024
- book2 = Book.open(@different_file)
1025
- excel = book1.excel
1026
- excel.workbooks_visible = true
1027
- excel.Visible.should be_true
1028
- book1.Windows(book1.Name).Visible.should be_true
1029
- book1.visible.should be_true
1030
- book2.Windows(book2.Name).Visible.should be_true
1031
- book2.visible.should be_true
1032
- end
1033
-
1034
- end
987
+
1035
988
 
1036
989
  context "with Visible and DisplayAlerts, focus" do
1037
990
 
@@ -1538,14 +1491,14 @@ module RobustExcelOle
1538
1491
 
1539
1492
  end
1540
1493
 
1541
- describe "set_options" do
1494
+ describe "for_this_instance" do
1542
1495
 
1543
1496
  before do
1544
1497
  @excel = Excel.new(:reuse => false)
1545
1498
  end
1546
1499
 
1547
- it "should set options" do
1548
- @excel.set_options(:displayalerts => true, :visible => true, :screenupdating => true, :calculaiton => :manual)
1500
+ it "should set options in the Excel instance" do
1501
+ @excel.for_this_instance(:displayalerts => true, :visible => true, :screenupdating => true, :calculaiton => :manual)
1549
1502
  @excel.DisplayAlerts.should be_true
1550
1503
  @excel.Visible.should be_true
1551
1504
  @excel.ScreenUpdating.should be_true
@@ -1556,6 +1509,51 @@ module RobustExcelOle
1556
1509
 
1557
1510
  end
1558
1511
 
1512
+ context "for_all_workbooks" do
1513
+
1514
+ it "should not raise an error for an empty Excel instance" do
1515
+ excel = Excel.create
1516
+ expect{
1517
+ excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
1518
+ }.to_not raise_error
1519
+ end
1520
+
1521
+ it "should set options to true for a workbook" do
1522
+ book1 = Book.open(@simple_file)
1523
+ book1.excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
1524
+ book1.excel.Visible.should be_true
1525
+ book1.Windows(book1.Name).Visible.should be_true
1526
+ book1.visible.should be_true
1527
+ book1.ReadOnly.should be_true
1528
+ book1.CheckCompatibility.should be_true
1529
+ end
1530
+
1531
+ it "should set options for two workbooks" do
1532
+ book1 = Book.open(@simple_file)
1533
+ book2 = Book.open(@different_file)
1534
+ excel = book1.excel
1535
+ excel.for_all_workbooks(:visible => true, :read_only => true, :check_compatibility => true)
1536
+ excel.Visible.should be_true
1537
+ book1.Windows(book1.Name).Visible.should be_true
1538
+ book1.visible.should be_true
1539
+ book1.ReadOnly.should be_true
1540
+ book1.CheckCompatibility.should be_true
1541
+ book2.Windows(book2.Name).Visible.should be_true
1542
+ book2.visible.should be_true
1543
+ book2.ReadOnly.should be_true
1544
+ book2.CheckCompatibility.should be_true
1545
+ excel.for_all_workbooks(:visible => false, :read_only => false, :check_compatibility => false)
1546
+ excel.Visible.should be_true
1547
+ book1.Windows(book1.Name).Visible.should be_false
1548
+ book1.visible.should be_false
1549
+ book2.Windows(book2.Name).Visible.should be_false
1550
+ book2.visible.should be_false
1551
+ book2.ReadOnly.should be_false
1552
+ book2.CheckCompatibility.should be_false
1553
+ end
1554
+
1555
+ end
1556
+
1559
1557
  describe "known_excel_instances" do
1560
1558
 
1561
1559
  it "should return empty list" do
data/spec/general_spec.rb CHANGED
@@ -171,7 +171,7 @@ module RobustExcelOle
171
171
  it "should raise an error for no strings" do
172
172
  expect{
173
173
  canonize(1)
174
- }.to raise_error(TypeErrorREO, "No string given to canonize, but 1")
174
+ }.to raise_error(TypeREOError, "No string given to canonize, but 1")
175
175
  end
176
176
 
177
177
  end
@@ -205,7 +205,7 @@ module RobustExcelOle
205
205
  it "should raise an error when asking excel of a sheet" do
206
206
  expect{
207
207
  @sheet.excel
208
- }.to raise_error(TypeErrorREO, "receiver instance is neither an Excel nor a Book")
208
+ }.to raise_error(TypeREOError, "receiver instance is neither an Excel nor a Book")
209
209
  end
210
210
  end
211
211
  end
@@ -100,7 +100,7 @@ module RobustExcelOle
100
100
  it "should raise an error when asking excel of a sheet" do
101
101
  expect{
102
102
  @sheet.excel
103
- }.to raise_error(TypeErrorREO, "receiver instance is neither an Excel nor a Book")
103
+ }.to raise_error(TypeREOError, "receiver instance is neither an Excel nor a Book")
104
104
  end
105
105
 
106
106
  end
data/spec/sheet_spec.rb CHANGED
@@ -583,6 +583,20 @@ describe Sheet do
583
583
  }.to raise_error(NameNotFound, /name "foo" not in #<Sheet: Sheet1/)
584
584
  end
585
585
 
586
+ it "should raise an error if name not defined and default value is not provided" do
587
+ expect {
588
+ @sheet1.rangeval("foo", :default => nil)
589
+ }.to_not raise_error
590
+ expect {
591
+ @sheet1.rangeval("foo", :default => :__not_provided)
592
+ }.to raise_error(NameNotFound, /name "foo" not in #<Sheet: Sheet1 another_workbook/)
593
+ expect {
594
+ @sheet1.rangeval("foo")
595
+ }.to raise_error(NameNotFound, /name "foo" not in #<Sheet: Sheet1 another_workbook/)
596
+ @sheet1.rangeval("foo", :default => nil).should be_nil
597
+ @sheet1.rangeval("foo", :default => 1).should == 1
598
+ @sheet1.nameval("empty", :default => 1).should be_nil
599
+ end
586
600
  end
587
601
 
588
602
  describe "set_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.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-16 00:00:00.000000000 Z
11
+ date: 2018-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -46,6 +46,12 @@ files:
46
46
  - LICENSE
47
47
  - README.rdoc
48
48
  - README_detail.rdoc
49
+ - README_development.rdoc
50
+ - README_excel.rdoc
51
+ - README_open.rdoc
52
+ - README_ranges.rdoc
53
+ - README_save_close.rdoc
54
+ - README_sheet.rdoc
49
55
  - Rakefile
50
56
  - TodoList.md
51
57
  - examples/edit_sheets/example_access_sheets_and_cells.rb