Sha256: 3aa10b9f6f4f256fd5d2b81015a86bfb2567507ab9dd2e8b284fb1c851d1f19b

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'rubygems'
require 'sqlite3'
require 'ruby-debug'
require 'test/unit'
require 'active_record'
require 'active_support/test_case'

require File.dirname(__FILE__) + '/../init.rb'

# Modifie la classe SalesClicExporter::Document::GoogleSpreadsheets 
# pour permettre d'avoir accès à l'objet 
SalesClicExporter::Document::GoogleSpreadsheets.class_eval do
  def google_doc ; @google ; end
end

class TestObject #< ActiveRecord::Base
  attr_accessor :name
  attr_accessor :value

  include ExportToSpreadsheet
end

def create_obj
  #return TestObject.create!(:name => "Affaire", :value => 999.7)
  test_obj       = TestObject.new
  test_obj.name  = "Affaire"
  test_obj.value = 999.7
  return test_obj
end

# On rend accessible la variable d'instance current_row_index seulement
# pour les tests
SalesClicExporter::Document::Base.class_eval do; attr_accessor :current_row_index; end

###############

def load_excel_file(filename)
  filepath = File.dirname(__FILE__) + '/resources/' + filename
  bytes    = IO::read(filepath)
  #bytes    = File.read(filepath, 'rb') { |fin| fin.bytes.to_a }
  excel    = SpreadsheetToArray::FromExcel.new(bytes)
end

def array_from_excel(filename)
  excel = load_excel_file(filename)
  excel.values
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
export_to_spreadsheet-0.1.2 test/test_helper.rb
export_to_spreadsheet-0.1.1 test/test_helper.rb
export_to_spreadsheet-0.1.0 test/test_helper.rb