remove invalid test since fog is gone

This commit is contained in:
Sam 2015-05-25 18:08:59 +10:00
parent f079dd63ed
commit 675e2c6e13
1 changed files with 2 additions and 92 deletions

View File

@ -3,96 +3,6 @@ require "spec_helper"
describe "S3Helper" do describe "S3Helper" do
before(:each) do # we should test something here, perhaps in a smoke test that uploads a real image
SiteSetting.stubs(:s3_access_key_id).returns("s3_access_key_id") # to s3
SiteSetting.stubs(:s3_secret_access_key).returns("s3_secret_access_key")
Fog.mock!
Fog::Mock.reset
Fog::Mock.delay = 0
end
after(:each) do
Fog.unmock!
end
let(:s3_bucket) { "s3_bucket_name" }
let(:tombstone_prefix) { nil }
let(:fog) { stub }
let(:s3) { S3Helper.new(s3_bucket, tombstone_prefix, fog) }
let(:filename) { "logo.png" }
let(:file) { file_from_fixtures(filename) }
it "ensures the bucket name isn't blank" do
expect { S3Helper.new("") }.to raise_error(Discourse::InvalidParameters)
end
describe ".upload" do
let(:fog) { nil }
it "works" do
result = s3.upload(file, filename)
expect(result).to be_a Fog::Storage::AWS::File
end
end
describe ".remove" do
context "without tombstone prefix" do
it "only deletes the object even when asked to copy it to the tombstone" do
fog.expects(:copy_object).never
fog.expects(:delete_object).with(s3_bucket, filename)
s3.remove(filename, true)
end
end
context "with tombstone prefix" do
let(:tombstone_prefix) { "tombstone/" }
it "only deletes the object by default" do
fog.expects(:copy_object).never
fog.expects(:delete_object).with(s3_bucket, filename)
s3.remove(filename)
end
it "copies the object to the tombstone and deletes it when asked for" do
fog.expects(:copy_object)
fog.expects(:delete_object).with(s3_bucket, filename)
s3.remove(filename, true)
end
end
end
describe ".update_tombstone_lifecycle" do
context "without tombstone prefix" do
it "doesn't call put_bucket_lifecycle" do
fog.expects(:put_bucket_lifecycle).never
s3.update_tombstone_lifecycle(3.days)
end
end
context "with tombstone prefix" do
let(:tombstone_prefix) { "tombstone/" }
it "calls put_bucket_lifecycle" do
fog.expects(:put_bucket_lifecycle)
s3.update_tombstone_lifecycle(3.days)
end
end
end
end end