Logo: Relish

  1. Sign in

Project: Appsent 0.1.0.rc1

Complex usage

Background
Given
a file named "Conffile" with:
system_config do

  google_analytics do
    code              String, 'Enter your google analytics code here' => 'UA-12345678-1'
    multiple_domains  String, 'has multiple domains?'
    domain            String, 'your domain' => 'example.com'
  end

  system_email String, :example => '[email protected]'

end

mongodb do
  host       String, 'Host to connect to MongoDB' => 'localhost'
  port       Fixnum, 'MongoDB port' => 27017
  pool_size  Fixnum
  timeout    Fixnum
end
And
a file named "my_app.rb" with:
require 'appsent'

AppSent.init :path => 'config', :env => 'production'

puts 'All stuff work!'
Scenarios
All config present and have right values
When
I write to "config/system_config.yml" with:
production:
  google_analytics:
    code: UA-123456
    multiple_domains: 'false' # FIXME do something with boolean values
    domain: gopa.sraka.com
  system_email: [email protected]
And
I write to "config/mongodb.yml" following:
production:
  host: 'somehost.com'
  port: 27017
  pool_size: 1
  timeout: 5
And
I run ruby my_app.rb
Then
the output should contain:
All stuff work!

Last published over 7 years ago by kucaahbe.