Rspec - wrong number of arguments when raising error

according to https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Errors/ServiceError.html#initialize-instance_method

the three arguments are

  • context (Seahorse::Client::RequestContext)
  • message (String)
  • data (Aws::Structure) (defaults to: Aws::EmptyStructure.new)

The message is where you can add your own information.


It turns out the problem was with:

and_raise(
  Aws::S3::Errors::Forbidden
)

Running this shows the same error:

raise(Aws::S3::Errors::Forbidden)

What does work is this:

raise(Aws::S3::Errors::Forbidden.new(nil, nil))