Skip to content

Commit

Permalink
Merge pull request #1413 from rspec/use-skip-instead-of-if-else
Browse files Browse the repository at this point in the history
Use :skip instead of :if/:unless
  • Loading branch information
pirj committed Feb 16, 2021
2 parents ff318bc + c4f23a1 commit 38de6cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/rspec/mocks/matchers/receive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ module Mocks
expect(receiver.foo).to eq(:curly)
end

it 'does not support other matchers', :unless => options.include?(:allow_other_matchers) do
it 'does not support other matchers', :skip => options.include?(:allow_other_matchers) do
expect {
wrapped.to eq(3)
}.to raise_error(UnsupportedMatcherError)
end

it 'does support inherited matchers', :unless => options.include?(:allow_other_matchers) do
it 'does support inherited matchers', :skip => options.include?(:allow_other_matchers) do
receive_foo = Class.new(RSpec::Mocks::Matchers::Receive).new(:foo, nil)
wrapped.to receive_foo
receiver.foo
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/mocks/mutate_const_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def change_const_value_to(value)
expect(::Hash).to equal(top_level_hash)
end

it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings, :if => RUBY_VERSION < '2.5' do
it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings, :skip => RUBY_VERSION >= '2.5' do
top_level_hash = ::Hash

hide_const("TestClass::Hash")
Expand Down

0 comments on commit 38de6cd

Please sign in to comment.