From 1198fcfd0a176d0deb64e22971f27a01ad5cc08f Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Mon, 2 Nov 2020 05:34:40 +0000 Subject: [PATCH] Fix type error on subscription show subcommand --- Changelog.md | 5 +++++ lib/mutant/license/subscription.rb | 2 +- lib/mutant/license/subscription/opensource.rb | 3 ++- spec/unit/mutant/license/subscription_spec.rb | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index b491cac36..0d3ab87f1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +# v0.10.2 2020-11-02 + +* Fix type error on subscription show subcommand whith active commercial license. + [#1074](https://github.com/mbj/mutant/pull/1084) + # v0.10.1 2020-10-29 * Add support for multiple cover expressions in minitest integration [#1076](https://github.com/mbj/mutant/pull/1076) diff --git a/lib/mutant/license/subscription.rb b/lib/mutant/license/subscription.rb index 6b8fec189..857dbeb8f 100644 --- a/lib/mutant/license/subscription.rb +++ b/lib/mutant/license/subscription.rb @@ -38,7 +38,7 @@ def self.load(world, value) # @return [String] def description FORMAT % { - licensed: licensed.join("\n"), + licensed: licensed.to_a.join("\n"), subscription_name: subscription_name } end diff --git a/lib/mutant/license/subscription/opensource.rb b/lib/mutant/license/subscription/opensource.rb index 5267e1ba3..da77b7cc6 100644 --- a/lib/mutant/license/subscription/opensource.rb +++ b/lib/mutant/license/subscription/opensource.rb @@ -46,6 +46,7 @@ def self.from_json(value) value .fetch('repositories') .map(&Repository.public_method(:parse)) + .to_set ) end @@ -59,7 +60,7 @@ def apply(world) private def check_subscription(actual) - if (licensed.to_set & actual).any? + if (licensed & actual).any? success else failure(licensed, actual) diff --git a/spec/unit/mutant/license/subscription_spec.rb b/spec/unit/mutant/license/subscription_spec.rb index 8bba7fa3c..4678051f9 100644 --- a/spec/unit/mutant/license/subscription_spec.rb +++ b/spec/unit/mutant/license/subscription_spec.rb @@ -12,7 +12,7 @@ def apply [ described_class::Commercial::Author.new('mbj@schirp-dso.com'), described_class::Commercial::Author.new('other@schirp-dso.com') - ] + ].to_set ) end @@ -32,7 +32,7 @@ def apply [ described_class::Opensource::Repository.new('github.com', 'mbj/mutant'), described_class::Opensource::Repository.new('github.com', 'mbj/unparser') - ] + ].to_set ) end @@ -109,7 +109,7 @@ def self.it_fails_with_message(expected) 'github.com', 'mbj/mutant' ) - ] + ].to_set ) end