- it "should return false if an array" do
- result = scope.function_is_string([["a","b","c"]])
- expect(result).to(eq(false))
+ context 'with deprecation warning' do
+ after(:each) do
+ ENV.delete('STDLIB_LOG_DEPRECATIONS')
+ end
+ # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
+ it 'displays a single deprecation' do
+ ENV['STDLIB_LOG_DEPRECATIONS'] = 'true'
+ expect(scope).to receive(:warning).with(include('This method is deprecated'))
+ is_expected.to run.with_params('sponge').and_return(true)
+ end
+ it 'displays no warning for deprecation' do
+ ENV['STDLIB_LOG_DEPRECATIONS'] = 'false'
+ expect(scope).to receive(:warning).with(include('This method is deprecated')).never
+ is_expected.to run.with_params('bob').and_return(true)
+ end