export_to_spreadsheet 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/test_helper.rb DELETED
@@ -1,47 +0,0 @@
1
- require 'rubygems'
2
- require 'sqlite3'
3
- require 'ruby-debug'
4
- require 'test/unit'
5
- require 'active_record'
6
- require 'active_support/test_case'
7
-
8
- require File.dirname(__FILE__) + '/../init.rb'
9
-
10
- # Modifie la classe SalesClicExporter::Document::GoogleSpreadsheets
11
- # pour permettre d'avoir accès à l'objet
12
- SalesClicExporter::Document::GoogleSpreadsheets.class_eval do
13
- def google_doc ; @google ; end
14
- end
15
-
16
- class TestObject #< ActiveRecord::Base
17
- attr_accessor :name
18
- attr_accessor :value
19
-
20
- include ExportToSpreadsheet
21
- end
22
-
23
- def create_obj
24
- #return TestObject.create!(:name => "Affaire", :value => 999.7)
25
- test_obj = TestObject.new
26
- test_obj.name = "Affaire"
27
- test_obj.value = 999.7
28
- return test_obj
29
- end
30
-
31
- # On rend accessible la variable d'instance current_row_index seulement
32
- # pour les tests
33
- SalesClicExporter::Document::Base.class_eval do; attr_accessor :current_row_index; end
34
-
35
- ###############
36
-
37
- def load_excel_file(filename)
38
- filepath = File.dirname(__FILE__) + '/resources/' + filename
39
- bytes = IO::read(filepath)
40
- #bytes = File.read(filepath, 'rb') { |fin| fin.bytes.to_a }
41
- excel = SpreadsheetToArray::FromExcel.new(bytes)
42
- end
43
-
44
- def array_from_excel(filename)
45
- excel = load_excel_file(filename)
46
- excel.values
47
- end