spec/lib/app_config_spec.rb in rails-service-0.1.0 vs spec/lib/app_config_spec.rb in rails-service-0.2.0

- old
+ new

@@ -1,19 +1,20 @@ require 'spec_helper' RSpec.describe Rails::Service::AppConfig do - let(:path) { 'config/app-config.yaml' } + let(:path) { RAILS_APP_ROOT.join('config/app-config.yaml') } let(:logger) { double(:logger) } let(:env) { 'test' } let(:config) { described_class.new(path: path, logger: logger, env: env) } - before do - @root_old = Rails.root - Rails.application.config.root = File.expand_path('spec/rails_app') - end - - after do - Rails.application.config.root = @root_old + around do |example| + old_root = Rails.root + begin + Rails.application.config.root = File.expand_path('spec/rails_app') + example.run + ensure + Rails.application.config.root = old_root + end end describe 'loading yaml config' do before do allow(logger).to receive(:info)