Skip to content

Commit

Permalink
Actually set ENVied.config
Browse files Browse the repository at this point in the history
  • Loading branch information
eval committed Feb 27, 2015
2 parents 5baba1c + 255dd4a commit cdaf3f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/envied.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def self.require(*args)

def self.env!(requested_groups, options = {})
@env = begin
config = options.fetch(:config) { Configuration.load }
@config = options.fetch(:config) { Configuration.load }
groups = required_groups(*requested_groups)
EnvProxy.new(config, groups: groups)
EnvProxy.new(@config, groups: groups)
end
end

Expand Down
12 changes: 12 additions & 0 deletions spec/envied_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

before do
reset_env
reset_envied_config
reset_configuration
end

Expand All @@ -23,6 +24,10 @@ def reset_env
ENVied.instance_eval { @env = nil }
end

def reset_envied_config
ENVied.instance_eval { @config = nil }
end

context 'configured' do

def unconfigured
Expand Down Expand Up @@ -78,6 +83,13 @@ def envied_require(*args)
expect(described_class).to_not respond_to :B
end

it 'sets ENVied.config' do
configured_with(a: :Integer).and_ENV({'a' => '1'})
envied_require

expect(ENVied.config).to_not be(nil)
end

context 'ENV contains not all configured variables' do
before { configured_with(a: :Integer).and_no_ENV }

Expand Down

0 comments on commit cdaf3f1

Please sign in to comment.