@@ -63,18 +63,37 @@ def rquote(str)
6363 before { subject . show_warnings }
6464
6565 context 'when silenced' do
66- around do |example |
67- old = ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ]
68- ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ] = '1'
69- example . run
70- ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ] = old
66+ context 'with an environment variable' do
67+ around do |example |
68+ old = ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ]
69+ ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ] = '1'
70+ example . run
71+ ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ] = old
72+ end
73+
74+ context 'with any outdated Ruby' do
75+ let ( :ruby_version ) { outdated_ruby }
76+ it 'does not show anything' do
77+ expect ( logger ) . to_not have_received ( :warning )
78+ expect ( logger ) . to_not have_received ( :notice )
79+ end
80+ end
7181 end
7282
73- context 'with any outdated Ruby' do
74- let ( :ruby_version ) { outdated_ruby }
75- it 'does not show anything' do
76- expect ( logger ) . to_not have_received ( :warning )
77- expect ( logger ) . to_not have_received ( :notice )
83+ context 'with a method call' do
84+ around do |example |
85+ old = ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ]
86+ subject . silence!
87+ example . run
88+ ENV [ 'RUBY_DEP_GEM_SILENCE_WARNINGS' ] = old
89+ end
90+
91+ context 'with any outdated Ruby' do
92+ let ( :ruby_version ) { outdated_ruby }
93+ it 'does not show anything' do
94+ expect ( logger ) . to_not have_received ( :warning )
95+ expect ( logger ) . to_not have_received ( :notice )
96+ end
7897 end
7998 end
8099 end
0 commit comments