Sha256: 16b55e1b755a0f4aa3efe2efdb8717dd3dd220874529e6cd9f2ec1fc74dacae5

Contents?: true

Size: 759 Bytes

Versions: 12

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

12 entries across 12 versions & 1 rubygems

Version Path
statsd-instrument-3.0.2 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.0.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.0.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.0.0.pre2 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.9.2 test/rubocop/splat_arguments_test.rb
statsd-instrument-3.0.0.pre1 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.9.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.9.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.8.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.7.1 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.7.0 test/rubocop/splat_arguments_test.rb
statsd-instrument-2.6.0 test/rubocop/splat_arguments_test.rb