Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#describe backup tests aren't actually testing anything #115

Open
Skarlso opened this issue Jul 28, 2016 · 0 comments
Open

#describe backup tests aren't actually testing anything #115

Skarlso opened this issue Jul 28, 2016 · 0 comments

Comments

@Skarlso
Copy link
Contributor

Skarlso commented Jul 28, 2016

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 }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant