Sha256: c22ed7b609ad40f6502968ef87508af9636ec7f5b878612dbce1208da72796e0

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

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 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

2 entries across 2 versions & 1 rubygems

Version Path
testcentricity_web-0.7.1 lib/testcentricity_web/data_objects_helper.rb
testcentricity_web-0.7.0 lib/testcentricity_web/data_objects_helper.rb