Skip to content
New issue

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

Fix specs #76

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ["2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "head"]
ruby-version: ["2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "head"]
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
Expand All @@ -34,6 +35,7 @@ jobs:
test-old:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
ruby-version: ["2.1", "2.2", "2.3"]
steps:
Expand Down
1 change: 1 addition & 0 deletions fog-brightbox.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.0"

spec.add_dependency "base64"
spec.add_dependency "fog-core", ">= 1.45", "< 3.0"
spec.add_dependency "fog-json"
spec.add_dependency "dry-inflector"
Expand Down
2 changes: 2 additions & 0 deletions lib/fog/brightbox/oauth2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "base64"

module Fog
module Brightbox
# This module covers Brightbox's partial implementation of OAuth 2.0
Expand Down
15 changes: 11 additions & 4 deletions spec/fog/brightbox/storage/authentication_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
describe Fog::Brightbox::Storage::AuthenticationRequest do
include StockStorageResponses

before do
# Excon v1.0 changes the behaviour and results in older versions of Ruby
# limited to v0.112.0 reporting failures since they can not match the Host
# header correctly.
Excon.defaults[:omit_default_port] = true
end

describe "when initialised with blank config" do
before do
stub_request(:get, "https://orbit.brightbox.com/v1")
.with(headers: {
"Host" => "orbit.brightbox.com:443",
"Host" => "orbit.brightbox.com",
"X-Auth-User" => "",
"X-Auth-Key" => ""
}).to_return(bad_url_response)
Expand All @@ -25,7 +32,7 @@
before do
stub_request(:get, "https://orbit.brightbox.com/v1")
.with(headers: {
"Host" => "orbit.brightbox.com:443",
"Host" => "orbit.brightbox.com",
"X-Auth-User" => "cli-12345",
"X-Auth-Key" => "12345"
}).to_return(authorized_response)
Expand All @@ -46,7 +53,7 @@
before do
stub_request(:get, "https://orbit.brightbox.com/v1")
.with(headers: {
"Host" => "orbit.brightbox.com:443",
"Host" => "orbit.brightbox.com",
"X-Auth-User" => "[email protected]",
"X-Auth-Key" => "abcde"
}).to_return(authorized_response)
Expand All @@ -69,7 +76,7 @@
before do
stub_request(:get, "https://orbit.brightbox.com/v1")
.with(headers: {
"Host" => "orbit.brightbox.com:443",
"Host" => "orbit.brightbox.com",
"X-Auth-User" => "[email protected]",
"X-Auth-Key" => "abcde"
}).to_return(unauthorized_response)
Expand Down
6 changes: 6 additions & 0 deletions spec/fog/compute/brightbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
}

@credential_guard = Minitest::Mock.new
# Stub for older versions of fog-core
def @credential_guard.reject
{}
end

# Stub for newer versions of fog-core
def @credential_guard.select
{}
end

Fog.stub :credentials, @credential_guard do
@service = Fog::Brightbox::Compute.new(@arguments)
end
Expand Down
Loading