robust_excel_ole 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
Binary file
Binary file
data/spec/excel_spec.rb CHANGED
@@ -783,7 +783,32 @@ module RobustExcelOle
783
783
  end
784
784
  end
785
785
 
786
+ describe "retain_saved_workbooks" do
786
787
 
788
+ before do
789
+ @book1 = Book.open(@simple_file)
790
+ @book2 = Book.open(@another_simple_file)
791
+ @book3 = Book.open(@different_file)
792
+ sheet2 = @book2.sheet(1)
793
+ sheet2[1,1] = sheet2[1,1].value == "foo" ? "bar" : "foo"
794
+ @book2.Saved.should be_false
795
+ @excel = Excel.current
796
+ end
797
+
798
+ it "should retain saved workbooks" do
799
+ @excel.retain_saved_workbooks do
800
+ sheet1 = @book1.sheet(1)
801
+ sheet1[1,1] = sheet1[1,1].value == "foo" ? "bar" : "foo"
802
+ @book1.Saved.should be_false
803
+ sheet3 = @book3.sheet(1)
804
+ sheet3[1,1] = sheet3[1,1].value == "foo" ? "bar" : "foo"
805
+ @book3.Saved.should be_false
806
+ end
807
+ @book1.Saved.should be_true
808
+ @book2.Saved.should be_false
809
+ @book3.Saved.should be_true
810
+ end
811
+ end
787
812
 
788
813
  describe "unsaved_workbooks" do
789
814
 
@@ -1339,13 +1364,13 @@ module RobustExcelOle
1339
1364
 
1340
1365
  it "should do with_calculation with workbook" do
1341
1366
  @excel1 = Excel.new
1342
- book = Book.open(@simple_file)
1343
- book.Windows(book.Name).Visible = true
1367
+ book = Book.open(@simple_file, :visible => true)
1344
1368
  old_calculation_mode = @excel1.Calculation
1345
1369
  @excel1.with_calculation(:manual) do
1346
1370
  @excel1.calculation.should == :manual
1347
1371
  @excel1.Calculation.should == -4135
1348
1372
  @excel1.CalculateBeforeSave.should be_false
1373
+ book.Saved.should be_true
1349
1374
  end
1350
1375
  @excel1.Calculation.should == old_calculation_mode
1351
1376
  @excel1.CalculateBeforeSave.should be_false
@@ -1353,6 +1378,7 @@ module RobustExcelOle
1353
1378
  @excel1.calculation.should == :automatic
1354
1379
  @excel1.Calculation.should == -4105
1355
1380
  @excel1.CalculateBeforeSave.should be_false
1381
+ book.Saved.should be_false
1356
1382
  end
1357
1383
  @excel1.Calculation.should == old_calculation_mode
1358
1384
  @excel1.CalculateBeforeSave.should be_false
@@ -1360,22 +1386,23 @@ module RobustExcelOle
1360
1386
 
1361
1387
  it "should set calculation mode to manual with workbook" do
1362
1388
  @excel1 = Excel.new
1363
- book = Book.open(@simple_file)
1389
+ book = Book.open(@simple_file, :visible => true)
1364
1390
  book.Windows(book.Name).Visible = true
1365
1391
  @excel1.calculation = :manual
1366
1392
  @excel1.calculation.should == :manual
1367
1393
  @excel1.Calculation.should == -4135
1368
1394
  @excel1.CalculateBeforeSave.should be_false
1395
+ book.Saved.should be_true
1369
1396
  end
1370
1397
 
1371
1398
  it "should set calculation mode to automatic with workbook" do
1372
1399
  @excel1 = Excel.new
1373
- book = Book.open(@simple_file)
1374
- book.Windows(book.Name).Visible = true
1400
+ book = Book.open(@simple_file, :visible => true)
1375
1401
  @excel1.calculation = :automatic
1376
1402
  @excel1.calculation.should == :automatic
1377
1403
  @excel1.Calculation.should == -4105
1378
1404
  @excel1.CalculateBeforeSave.should be_false
1405
+ book.Saved.should be_false
1379
1406
  end
1380
1407
 
1381
1408
  it "should set Calculation without workbooks" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robust_excel_ole
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - traths
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2017-04-16 00:00:00 +02:00
18
+ date: 2017-07-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency