Sha256: ba6821b496a6cc949698fbdac246092c9b4eb0c9ea51b06a6579567dff653cf8
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require 'yaml' module TestCentricity XL_PRIMARY_DATA_PATH ||= 'features/test_data/' XL_PRIMARY_DATA_FILE ||= "#{XL_PRIMARY_DATA_PATH}data.xls" class DataObject attr_accessor :current attr_accessor :context attr_accessor :hash_table def initialize(data) @hash_table = data end def self.set_current(current) @current = current end def self.current @current end end class DataSource attr_accessor :current def read_yaml_node_data(file_name, node_name) data = YAML.load_file("#{XL_PRIMARY_DATA_PATH}#{file_name}") data[node_name] end end class ExcelDataSource < TestCentricity::DataSource 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 def read_excel_row_data(sheet, row_name) ExcelData.read_row_data(pick_excel_data_source(sheet, row_name), sheet, row_name) end def read_excel_pool_data(sheet, row_name) ExcelData.read_row_from_pool(pick_excel_data_source(sheet, row_name), sheet, row_name) end def read_excel_range_data(sheet, range_name) ExcelData.read_range_data(pick_excel_data_source(sheet, range_name), sheet, range_name) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
testcentricity_web-0.7.8 | lib/testcentricity_web/data_objects_helper.rb |