#describe backup tests aren't actually testing anything
Skarlso opened this issue · comments
Gergely Brautigam commented
The test in backup_tests.rb, namly these guys: describe '#backup' do
, aren't actually testing anything.
They only test mock calls because of allow expect. I can delete every function like, tar, zip, upload and the tests are still green after subject.upload.
I'm order to actually test s3_client, AWS files need to be mocked because of fakefs. For a working example have a look at client_test.rb after the PR has been merged.
Example spoofing AWS
before(:all) do
# Using doubles without context is unsupported. with_temporary_scope to the rescue.
RSpec::Mocks.with_temporary_scope do
allow(Aws::S3::Client).to receive(:new).and_return(instance_double(Aws::S3::Client))
end
end
...
Aws.config[:s3] = {
stub_responses: {
list_objects: { contents: contents }
}
}