S3 and Swift now run the same specs. The only difference is the before block that defines the stubbed HTTP requests and the responses from the Swift and S3 servers
57 lines
2.8 KiB
Ruby
57 lines
2.8 KiB
Ruby
require_relative "../spec_helper"
|
|
|
|
describe "App" do
|
|
def container_url_for(user)
|
|
"#{app.settings.swift["host"]}/rs:documents:test/#{user}"
|
|
end
|
|
|
|
def storage_class
|
|
RemoteStorage::Swift
|
|
end
|
|
|
|
def config_file
|
|
"config.yml.example.swift"
|
|
end
|
|
|
|
before do
|
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
|
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
|
with(body: "si").
|
|
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
|
with(body: "aye").
|
|
to_return(status: 200, headers: { etag: "0915etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
|
with(body: "deliciosa").
|
|
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
|
with(body: "muy deliciosa").
|
|
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:head, "#{container_url_for("phil")}/food/aguacate").
|
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:delete, "#{container_url_for("phil")}/food/aguacate").
|
|
to_return(status: 200, headers: { etag: "0815etag" })
|
|
stub_request(:put, "#{container_url_for("phil")}/food/camaron").
|
|
to_return(status: 200, headers: { etag: "0816etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:delete, "#{container_url_for("phil")}/food/camaron").
|
|
to_return(status: 200, headers: { etag: "0816etag" })
|
|
stub_request(:put, "#{container_url_for("phil")}/food/desayunos/bolon").
|
|
to_return(status: 200, headers: { etag: "0817etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:delete, "#{container_url_for("phil")}/food/desayunos/bolon").
|
|
to_return(status: 200, headers: { etag: "0817etag" })
|
|
stub_request(:get, "#{container_url_for("phil")}/food/aguacate").
|
|
to_return(status: 200, body: "rootbody", headers: { etag: "0817etag", content_type: "text/plain; charset=utf-8" })
|
|
stub_request(:put, "#{container_url_for("phil")}/bamboo.txt").
|
|
to_return(status: 200, headers: { etag: "0818etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
stub_request(:head, "#{container_url_for("phil")}/food/steak").
|
|
to_return(status: 404)
|
|
stub_request(:get, "#{container_url_for("phil")}/food/steak").
|
|
to_return(status: 404)
|
|
stub_request(:delete, "#{container_url_for("phil")}/food/steak").
|
|
to_return(status: 404)
|
|
end
|
|
|
|
it_behaves_like 'a REST adapter'
|
|
end
|