Class: TestCentricity::ExcelDataSource

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

Direct Known Subclasses

EnvironData

Instance Attribute Summary

Attributes inherited from DataSource

#current

Instance Method Summary collapse

Methods inherited from DataSource

#read_json_node_data, #read_yaml_node_data

Instance Method Details

#pick_excel_data_source(sheet, row_name) ⇒ Object



47
48
49
50
51
52
# File 'lib/testcentricity_web/data_objects_helper.rb', line 47

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



58
59
60
# File 'lib/testcentricity_web/data_objects_helper.rb', line 58

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



62
63
64
# File 'lib/testcentricity_web/data_objects_helper.rb', line 62

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



54
55
56
# File 'lib/testcentricity_web/data_objects_helper.rb', line 54

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