We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using fog-aws 0.12.0 on ruby 2.3.1p112
I was trying to test that my code works properly when receiving a Fog::Compute::AWS::Image. As I'm using RSpec I was trying this:
Fog::Compute::AWS::Image
instance_double(Fog::Compute::AWS::Image)
This triggers a NameError: uninitialized constant Fog::Compute::AWS::Image though, even though fog is required and used.
NameError: uninitialized constant Fog::Compute::AWS::Image
I could only get it working in my specs reliabaly by explicitly requiring fog/aws/models/compute/image.
fog/aws/models/compute/image
In non-test code this works fine, but only because we use other APIs to fetch a list of images (it seems in those cases the class is properly loaded).
Is this a bug? If not, what is the recommended best practice in those cases?
The text was updated successfully, but these errors were encountered:
@tisba related classes are loaded after client instantiation.Fog::Compute::AWS.new will cause models, collections, and requests to be required.
Fog::Compute::AWS.new
See:
Sorry, something went wrong.
So the recommendation would be to set up the test/example by calling Fog::Compute::AWS.new?
Thanks, that works for me. It's not perfect, but better then requiring the file directly :)
@tisba instantiating a client is the safest solution. Depending on your usage, requiring the individual file may be sufficient.
No branches or pull requests
Using fog-aws 0.12.0 on ruby 2.3.1p112
I was trying to test that my code works properly when receiving a
Fog::Compute::AWS::Image
. As I'm using RSpec I was trying this:This triggers a
NameError: uninitialized constant Fog::Compute::AWS::Image
though, even though fog is required and used.I could only get it working in my specs reliabaly by explicitly requiring
fog/aws/models/compute/image
.In non-test code this works fine, but only because we use other APIs to fetch a list of images (it seems in those cases the class is properly loaded).
Is this a bug? If not, what is the recommended best practice in those cases?
The text was updated successfully, but these errors were encountered: