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.9.7 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.6 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.5 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.4 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.3 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.2 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.9.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.8.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.7.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.6.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.6.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.12 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.11 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.10 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.9 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.8 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.7 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.6 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.5.5 test/rubocop/splat_arguments_test.rb