Class: TestCentricity::ExcelDataSource

Inherits:
Object
  • Object
show all
Defined in:
lib/testcentricity_web/data_objects_helper.rb

Direct Known Subclasses

EnvironData

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#currentObject

Returns the value of attribute current.



27
28
29
# File 'lib/testcentricity_web/data_objects_helper.rb', line 27

def current
  @current
end

Instance Method Details

#pick_excel_data_source(sheet, row_name) ⇒ Object



29
30
31
32
33
34
# File 'lib/testcentricity_web/data_objects_helper.rb', line 29

def pick_excel_data_source(sheet, row_name)
  environment = ENV['TEST_ENVIRONMENT']
  data_file = "#{XL_PRIMARY_DATA_PATH}#{environment}_data.xls"
  data_file = XL_PRIMARY_DATA_FILE unless ExcelData.rowspec_exists?(data_file, sheet, row_name)
  data_file
end

#read_excel_pool_data(sheet, row_name) ⇒ Object



40
41
42
# File 'lib/testcentricity_web/data_objects_helper.rb', line 40

def read_excel_pool_data(sheet, row_name)
  ExcelData.read_row_from_pool(pick_excel_data_source(sheet, row_name), sheet, row_name)
end

#read_excel_range_data(sheet, range_name) ⇒ Object



44
45
46
# File 'lib/testcentricity_web/data_objects_helper.rb', line 44

def read_excel_range_data(sheet, range_name)
  ExcelData.read_range_data(pick_excel_data_source(sheet, range_name), sheet, range_name)
end

#read_excel_row_data(sheet, row_name) ⇒ Object



36
37
38
# File 'lib/testcentricity_web/data_objects_helper.rb', line 36

def read_excel_row_data(sheet, row_name)
  ExcelData.read_row_data(pick_excel_data_source(sheet, row_name), sheet, row_name)
end