spec/unit/a9n_spec.rb in a9n-0.8.3 vs spec/unit/a9n_spec.rb in a9n-0.9.0
- old
+ new
@@ -37,10 +37,17 @@
expect(subject.env.production?).to eq(false)
end
end
context 'unknown env' do
+ before do
+ expect(subject).to receive(:app_env).and_return(nil)
+ expect(subject).to receive(:env_var).with('RAILS_ENV').and_return(nil)
+ expect(subject).to receive(:env_var).with('RACK_ENV').and_return(nil)
+ expect(subject).to receive(:env_var).with('APP_ENV').and_return(nil)
+ end
+
it do
expect { subject.env }.to raise_error(A9n::UnknownEnvError)
end
end
end
@@ -49,11 +56,12 @@
before do
subject.env = 'development'
end
it do
- expect(subject.groups).to eq(['default', 'development'])
+ expect(subject.groups).to eq(%w[default development])
+ expect(subject.groups).to be_frozen
end
end
describe '.app' do
context 'when rails not found' do
@@ -104,10 +112,11 @@
subject.root = '/home/knapo/workspace/a9n'
end
it do
expect(subject.root).to eq(Pathname.new('/home/knapo/workspace/a9n'))
+ expect(subject.root).to be_frozen
end
end
context 'with local app path' do
it do
@@ -170,9 +179,10 @@
ENV['FOO'] = 'little foo'
end
it do
expect(subject.env_var('FOO')).to eq('little foo')
+ expect(subject.env_var('FOO')).to be_frozen
end
it do
expect(subject.env_var('IS_FOO')).to be_nil
end