diff --git a/lib/bundler/gem_bytes/gemspec/upsert_dependency.rb b/lib/bundler/gem_bytes/gemspec/upsert_dependency.rb index 67c1146..5a7f62b 100644 --- a/lib/bundler/gem_bytes/gemspec/upsert_dependency.rb +++ b/lib/bundler/gem_bytes/gemspec/upsert_dependency.rb @@ -194,6 +194,7 @@ def dependency_method_to_type(method) # @return [String] The error message # @api private def dependency_type_conflict_error(node) + # :nocov: JRuby give false positive for this line being uncovered by tests <<~MESSAGE.chomp.gsub("\n", ' ') Trying to add a #{dependency_method_to_type(dependency_type_method).upcase} @@ -203,6 +204,7 @@ def dependency_type_conflict_error(node) Pass force: true to update dependencies where the dependency type is different. MESSAGE + # :nocov: end # Checks if the given dependency type conflicts with the existing dependency type @@ -253,10 +255,8 @@ def update_dependency # @api private def dependency_type=(dependency_type) unless %i[runtime development].include?(dependency_type) - raise( - ArgumentError, - "Invalid dependency type: #{dependency_type.inspect}" - ) + message = "Invalid dependency type: #{dependency_type.inspect}" + raise(ArgumentError, message) end @dependency_type = dependency_type end @@ -292,6 +292,7 @@ def dependency_type_method # @return [RuboCop::AST::NodePattern] The dependency pattern # @api private def dependency_pattern + # :nocov: JRuby give false positive for this line being uncovered by tests @dependency_pattern ||= RuboCop::AST::NodePattern.new(<<~PATTERN) (send @@ -301,6 +302,7 @@ def dependency_pattern <(str $_version_constraint) ...> ) PATTERN + # :nocov: end # The pattern to match the Gem::Specification block in the AST diff --git a/spec/lib/bundler/gem_bytes/gemspec/upsert_dependency_spec.rb b/spec/lib/bundler/gem_bytes/gemspec/upsert_dependency_spec.rb index 34573d2..83b09ce 100644 --- a/spec/lib/bundler/gem_bytes/gemspec/upsert_dependency_spec.rb +++ b/spec/lib/bundler/gem_bytes/gemspec/upsert_dependency_spec.rb @@ -13,6 +13,7 @@ context 'with valid arguments' do let(:expected_attributes) do + # :nocov: JRuby give false positive for this line being uncovered by tests { dependency_type: :development, gem_name: 'test_tool', @@ -20,6 +21,7 @@ force: false, found_dependencies: [] } + # :nocov: end it { is_expected.to have_attributes(expected_attributes) }