Class: TestCentricity::ExcelDataSource

Inherits:
DataSource show all
Defined in:
lib/testcentricity_web/data_objects/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_spec) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 53

def pick_excel_data_source(sheet, row_spec)
  if ENV['TEST_ENVIRONMENT']
    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_spec)
  else
    data_file = XL_PRIMARY_DATA_FILE
  end
  data_file
end

#read_excel_pool_data(sheet, row_name, parallel = false) ⇒ Object



69
70
71
72
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 69

def read_excel_pool_data(sheet, row_name, parallel = false)
  parallel == :parallel && ENV['PARALLEL'] ? row_spec = "#{row_name}#{ENV['TEST_ENV_NUMBER']}" : row_spec = row_name
  ExcelData.read_row_from_pool(pick_excel_data_source(sheet, row_name), sheet, row_spec)
end

#read_excel_range_data(sheet, range_name) ⇒ Object



74
75
76
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 74

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, parallel = false) ⇒ Object



64
65
66
67
# File 'lib/testcentricity_web/data_objects/data_objects_helper.rb', line 64

def read_excel_row_data(sheet, row_name, parallel = false)
  parallel == :parallel && ENV['PARALLEL'] ? row_spec = "#{row_name}#{ENV['TEST_ENV_NUMBER']}" : row_spec = row_name
  ExcelData.read_row_data(pick_excel_data_source(sheet, row_spec), sheet, row_spec)
end