Commit b31b460f55f9464b6fc465a18e0e2153f0716f69
1 parent
b29ee282
Exists in
master
and in
1 other branch
add more specs for configurator
Showing
3 changed files
with
24 additions
and
2 deletions
Show diff stats
.env.default
| ... | ... | @@ -18,5 +18,4 @@ MONGO_URL='mongodb://localhost' |
| 18 | 18 | GITHUB_URL='https://github.com' |
| 19 | 19 | GITHUB_AUTHENTICATION=true |
| 20 | 20 | GITHUB_ACCESS_SCOPE='[repo]' |
| 21 | -EMAIL_DELIVERY_METHOD=sendmail | |
| 22 | 21 | DEVISE_MODULES='[database_authenticatable,recoverable,rememberable,trackable,validatable,omniauthable]' | ... | ... |
docs/configuration.md
| ... | ... | @@ -75,7 +75,6 @@ In order of precedence Errbit uses: |
| 75 | 75 | <dd>defaults to [repo] |
| 76 | 76 | <dt>EMAIL_DELIVERY_METHOD |
| 77 | 77 | <dd>:smtp or :sendmail, depending on how you want Errbit to send email |
| 78 | -<dd>defaults to :sendmail | |
| 79 | 78 | <dt>SMTP_SERVER |
| 80 | 79 | <dd>Server address for outgoing SMTP messages |
| 81 | 80 | <dt>SMTP_PORT | ... | ... |
spec/lib/configurator_spec.rb
| ... | ... | @@ -34,4 +34,28 @@ describe Configurator do |
| 34 | 34 | }) |
| 35 | 35 | expect(result.one).to eq('zoom') |
| 36 | 36 | end |
| 37 | + | |
| 38 | + it 'extracts symbol values' do | |
| 39 | + allow(ENV).to receive(:[]).with('MYSYMBOL').and_return(':asymbol') | |
| 40 | + result = Configurator.run({ mysymbol: ['MYSYMBOL'] }) | |
| 41 | + expect(result.mysymbol).to be(:asymbol) | |
| 42 | + end | |
| 43 | + | |
| 44 | + it 'extracts array values' do | |
| 45 | + allow(ENV).to receive(:[]).with('MYARRAY').and_return('[one,two,three]') | |
| 46 | + result = Configurator.run({ myarray: ['MYARRAY'] }) | |
| 47 | + expect(result.myarray).to eq(['one', 'two', 'three']) | |
| 48 | + end | |
| 49 | + | |
| 50 | + it 'extracts booleans' do | |
| 51 | + allow(ENV).to receive(:[]).with('MYBOOLEAN').and_return('true') | |
| 52 | + result = Configurator.run({ myboolean: ['MYBOOLEAN'] }) | |
| 53 | + expect(result.myboolean).to be(true) | |
| 54 | + end | |
| 55 | + | |
| 56 | + it 'extracts numbers' do | |
| 57 | + allow(ENV).to receive(:[]).with('MYNUMBER').and_return('0') | |
| 58 | + result = Configurator.run({ mynumber: ['MYNUMBER'] }) | |
| 59 | + expect(result.mynumber).to be(0) | |
| 60 | + end | |
| 37 | 61 | end | ... | ... |