Merge pull request #4214 from reitermarkus/fix-rspec-deprecations

Fix `rspec` deprecations.
This commit is contained in:
Mike McQuaid 2018-05-26 08:19:25 +01:00 committed by GitHub
commit 963adfafc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -21,7 +21,7 @@ describe CacheStoreDatabase do
allow(File).to receive(:write) allow(File).to receive(:write)
allow(subject).to receive(:created?).and_return(true) allow(subject).to receive(:created?).and_return(true)
expect(db).to receive(:has_key?).with(:foo).and_return(false) expect(db).to receive(:has_key?).with(:foo).and_return(false)
subject.stub(:db).and_return(db) allow(subject).to receive(:db).and_return(db)
end end
it "sets the value in the `CacheStoreDatabase`" do it "sets the value in the `CacheStoreDatabase`" do
@ -37,7 +37,7 @@ describe CacheStoreDatabase do
before(:each) do before(:each) do
allow(subject).to receive(:created?).and_return(true) allow(subject).to receive(:created?).and_return(true)
expect(db).to receive(:has_key?).with(:foo).and_return(true) expect(db).to receive(:has_key?).with(:foo).and_return(true)
subject.stub(:db).and_return(db) allow(subject).to receive(:db).and_return(db)
end end
it "gets value in the `CacheStoreDatabase` corresponding to the key" do it "gets value in the `CacheStoreDatabase` corresponding to the key" do
@ -51,7 +51,7 @@ describe CacheStoreDatabase do
before(:each) do before(:each) do
allow(subject).to receive(:created?).and_return(false) allow(subject).to receive(:created?).and_return(false)
subject.stub(:db).and_return(db) allow(subject).to receive(:db).and_return(db)
end end
it "does not get value in the `CacheStoreDatabase` corresponding to key" do it "does not get value in the `CacheStoreDatabase` corresponding to key" do
@ -71,7 +71,7 @@ describe CacheStoreDatabase do
before(:each) do before(:each) do
allow(subject).to receive(:created?).and_return(true) allow(subject).to receive(:created?).and_return(true)
subject.stub(:db).and_return(db) allow(subject).to receive(:db).and_return(db)
end end
it "deletes value in the `CacheStoreDatabase` corresponding to the key" do it "deletes value in the `CacheStoreDatabase` corresponding to the key" do
@ -85,7 +85,7 @@ describe CacheStoreDatabase do
before(:each) do before(:each) do
allow(subject).to receive(:created?).and_return(false) allow(subject).to receive(:created?).and_return(false)
subject.stub(:db).and_return(db) allow(subject).to receive(:db).and_return(db)
end end
it "does not call `db.delete` if `CacheStoreDatabase.created?` is `false`" do it "does not call `db.delete` if `CacheStoreDatabase.created?` is `false`" do
@ -121,7 +121,7 @@ describe CacheStoreDatabase do
let(:cache_path) { "path/to/homebrew/cache/sample.db" } let(:cache_path) { "path/to/homebrew/cache/sample.db" }
before(:each) do before(:each) do
subject.stub(:cache_path).and_return(cache_path) allow(subject).to receive(:cache_path).and_return(cache_path)
end end
context "`File.exist?(cache_path)` returns `true`" do context "`File.exist?(cache_path)` returns `true`" do

View File

@ -41,6 +41,8 @@ TEST_DIRECTORIES = [
RSpec.configure do |config| RSpec.configure do |config|
config.order = :random config.order = :random
config.raise_errors_for_deprecations!
config.filter_run_when_matching :focus config.filter_run_when_matching :focus
# TODO: when https://github.com/rspec/rspec-expectations/pull/1056 # TODO: when https://github.com/rspec/rspec-expectations/pull/1056