mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fcd22c9a9a
The abstraction modules e.g. `Fog::Compute` have a list of registered providers. All of these providers should be loaded correctly when accessed with `Fog::Service[:provider]` These tests hit each endpoint expecting `ArgumentError` from each provider caused by the lack of credentials. Credentials are stubbed out to not cause false results when the test environment does have credentials for a service. Some services do not have requirements so do not raise the expected error. These special cases are just asserted. If they are not loaded the specs fail again.
20 lines
677 B
Ruby
20 lines
677 B
Ruby
require "minitest/autorun"
|
|
require "fog"
|
|
|
|
describe Fog::Compute do
|
|
Fog::Compute.providers.each do |provider|
|
|
describe "when #{provider} is passed with no available credentials" do
|
|
it "returns ArgumentError" do
|
|
# Stub credentials so you still see errors where the tester really has credentials
|
|
Fog.stub :credentials, {} do
|
|
# These providers do not raise ArgumentError since they have no requirements defined
|
|
if [:openvz, :vmfusion].include?(provider)
|
|
assert Fog::Compute[provider]
|
|
else
|
|
assert_raises(ArgumentError) { Fog::Compute[provider] }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|