Sha256: 2e96df0dd19e8d234e14effad5e9dd786aed0365b60ace65da1a98ddcd52ec30

Contents?: true

Size: 759 Bytes

Versions: 32

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true

require "test_helper"
require "statsd/instrument/rubocop"

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

32 entries across 32 versions & 1 rubygems

Version Path
statsd-instrument-3.5.4 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.3 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.2 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.4.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.3.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.2.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.2.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.1.2 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.1.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.1.0 test/rubocop/splat_arguments_test.rb