Sha256: 3376d4581a37de7055e919fdb7a5cb02a56bd6119d601cf073a5c179da5614cb

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'
require 'statsd/instrument/rubocop/splat_arguments'

module Rubocop
  class SplatArgumentsTest < Minitest::Test
    include RubocopHelper

    def setup
      @cop = RuboCop::Cop::StatsD::SplatArguments.new
    end

    def test_no_offenses
      assert_no_offenses("StatsD.increment 'foo'")
      assert_no_offenses("StatsD.gauge('foo', 2, tags: 'foo')")
      assert_no_offenses("StatsD.measure('foo', 2, **kwargs)")
      assert_no_offenses("StatsD.measure('foo', 2, **kwargs) { }")
    end

    def test_offenses
      assert_offense("StatsD.increment(*increment_arguments)")
      assert_offense("StatsD.gauge('foo', 2, *options)")
      assert_offense("StatsD.measure('foo', 2, *options, &block)")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
statsd-instrument-2.5.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.5.0 test/rubocop/splat_arguments_test.rb