Skip to content

Commit

Permalink
Make the kind param mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
lagartoflojo committed Dec 18, 2017
1 parent d5975cf commit 53e849c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/suse/connect/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def system_activations(auth)
#
# @return [Array <Array <Hash>>] the list of possible upgrade paths for the given products,
# where each product is represented by a hash with identifier, version, arch and release_type
def system_migrations(auth, products, kind: :online, target_base_product: nil)
def system_migrations(auth, products, target_base_product: nil, kind:)
payload = { installed_products: products.map(&:to_params) }
payload[:target_base_product] = target_base_product.to_params if target_base_product
endpoints = {
Expand Down
7 changes: 3 additions & 4 deletions spec/connect/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,15 @@
end

context 'with no specified kind' do
subject { api.new(client).system_migrations('Basic: encodedgibberish', products) }
subject { api.new(client).system_migrations('Basic: encodedgibberish', []) }

it_behaves_like 'a query with no specified target base that returns migration paths', :online
it_behaves_like 'a query with no specified target base that returns no migration paths', :online
specify { expect { subject }.to raise_error(ArgumentError, 'missing keyword: kind') }
end

context 'with a kind that is not :online nor :offline' do
subject { api.new(client).system_migrations('Basic: encodedgibberish', [], kind: :bad) }

specify { expect { subject }.to raise_error(KeyError) }
specify { expect { subject }.to raise_error(KeyError, 'key not found: :bad') }
end
end

Expand Down

0 comments on commit 53e849c

Please sign in to comment.