Sha256: 6bb27db96cd57dd16d3a2c77696952fb1b0d4cd342414ac626fabcd51a7fad73

Contents?: true

Size: 978 Bytes

Versions: 5

Compression:

Stored size: 978 Bytes

Contents

class FeaturesConfig
  cattr_accessor :root   # root of the config file
  cattr_accessor :server # 'pointer' to the server selected

  def self.load
    self.server = nil
    load_file
    select_server
  end

  protected

  def self.load_file
    file = File.join(File.dirname(__FILE__), "..", "config.yml")
    unless File.exists?(file)
      throw Exception.new("Could not load #{file}. Please create it to be able to run the integration tests.")
    end
    self.root = YAML.load_file(file)
  end

  def self.select_server
    if ENV['SERVER']
      unless self.root['servers'].has_key?(ENV['SERVER'])
        throw Exception.new("Server #{ENV['SERVER']} does not exists in your configuration file.")
      end
      server = self.root['servers'][ENV['SERVER']]
    else
      server = self.root['servers'].first[1]
    end
    server['version'] = '0.9' unless server.has_key?('version')
    server['name'] = URI.parse(server['url']).host
    self.server = server
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bigbluebutton_rails-3.0.0 spec/rails_app/features/support/configurations.rb
bigbluebutton_rails-2.3.0 spec/rails_app/features/support/configurations.rb
bigbluebutton_rails-2.2.0 spec/rails_app/features/support/configurations.rb
bigbluebutton_rails-2.1.0 spec/rails_app/features/support/configurations.rb
bigbluebutton_rails-2.0.0 spec/rails_app/features/support/configurations.rb