Skip to content

Commit

Permalink
Fix specs for 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Oct 2, 2024
1 parent 9eb8906 commit e492850
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/rspec/mocks/any_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1078,16 +1078,17 @@ def foo; end

let(:object) { klass.new }

# The map(&:to_sym) is for legacy Ruby compatability and can be dropped in RSpec 4
it "maintains the method in the list of private_methods" do
expect {
verify_all
}.to_not change { object.private_methods.include?(:private_method) }.from(true)
}.to_not change { object.private_methods.map(&:to_sym).include?(:private_method) }.from(true)
end

it "maintains the methods exclusion from the list of public_methods" do
expect {
verify_all
}.to_not change { object.public_methods.include?(:private_method) }.from(false)
}.to_not change { object.public_methods.map(&:to_sym).include?(:private_method) }.from(false)
end

it "maintains the methods visibility" do
Expand Down Expand Up @@ -1129,7 +1130,7 @@ def foo; end

it "restores a stubbed private method after the spec is run" do
expect(klass.private_method_defined?(:private_method)).to be_truthy
expect(klass.new.private_methods).to include :private_method
expect(klass.new.private_methods.map(&:to_sym)).to include :private_method
end

it "ensures that the restored method behaves as it originally did" do
Expand Down

0 comments on commit e492850

Please sign in to comment.