Module: Frameworks::EnvHelper

Defined in:
lib/frameworks/cucumber.rb

Instance Method Summary collapse

Instance Method Details

#generate_base_urlsObject

Generate base urls to use in Cucumber step defs



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/frameworks/cucumber.rb', line 17

def generate_base_urls 
  set_scheme
  if(ENV['ENVIRONMENT']=='sandbox')
    @base_url = @sandbox + @bbc_domain 
    @static_base_url = @static_sandbox + @bbc_domain
  elsif (ENV['ENVIRONMENT']=='live' && ENV['WWW_LIVE']=='false')
    @base_url = @www_prefix.chop + @bbc_domain
    @static_base_url = @static_prefix.chop + @bbc_domain
    @open_base_url = @open_prefix.chop + @bbc_domain
  elsif (ENV['ENVIRONMENT'].split('.')[0].include? 'pal') #address specific box
    @base_url = "#{scheme}://#{ENV['ENVIRONMENT']}" 
  else
    @base_url = @www_prefix + ENV['ENVIRONMENT'] + @bbc_domain
    @static_base_url = @static_prefix + ENV['ENVIRONMENT'] + @bbc_domain
    @open_base_url = @open_prefix + ENV['ENVIRONMENT'] + @bbc_domain
  end
end

#set_schemeObject



35
36
37
38
39
40
41
42
43
# File 'lib/frameworks/cucumber.rb', line 35

def set_scheme  
  ENV['SCHEME']=='https' ? scheme = 'https' : scheme = 'http'
  @www_prefix = "#{scheme}://www."
  @static_prefix = "#{scheme}://static."
  @open_prefix = "#{scheme}://open."
  @bbc_domain = '.bbc.co.uk'
  @sandbox = "#{scheme}://pal.sandbox.dev"
  @static_sandbox = "#{scheme}://static.sandbox.dev"
end