Sha256: 9c24ce0f0c0f7bdc540ffd16990188692e712814b9bac0342bb1de5b09a4d39d

Contents?: true

Size: 979 Bytes

Versions: 42

Compression:

Stored size: 979 Bytes

Contents

module RBS
  module Test
    module SetupHelper
      class InvalidSampleSizeError < StandardError
        attr_reader :string

        def initialize(string)
          @string = string
          super("Sample size should be a positive integer: `#{string}`")
        end
      end

      DEFAULT_SAMPLE_SIZE = 100

      def get_sample_size(string)
        case string
        when ""
          DEFAULT_SAMPLE_SIZE
        when 'ALL'
          nil
        else
          int_size = string.to_i
          raise InvalidSampleSizeError.new(string) unless int_size.positive?
          int_size
        end
      end

      def to_double_class(double_suite)
        return nil unless double_suite

        case double_suite.downcase.strip
        when 'rspec'
          ['::RSpec::Mocks::Double']
        when 'minitest'
          ['::Minitest::Mock']
        else
          RBS.logger.warn "Unknown test suite - defaults to nil"
          nil
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
rbs-2.5.1 lib/rbs/test/setup_helper.rb
rbs-2.5.0 lib/rbs/test/setup_helper.rb
rbs-2.4.0 lib/rbs/test/setup_helper.rb
rbs-2.3.2 lib/rbs/test/setup_helper.rb
rbs-2.3.1 lib/rbs/test/setup_helper.rb
rbs-2.3.0 lib/rbs/test/setup_helper.rb
rbs-2.2.2 lib/rbs/test/setup_helper.rb
rbs-2.2.1 lib/rbs/test/setup_helper.rb
rbs-2.2.0 lib/rbs/test/setup_helper.rb
rbs-2.1.0 lib/rbs/test/setup_helper.rb
rbs-2.0.0 lib/rbs/test/setup_helper.rb
rbs-2.0.0.pre2 lib/rbs/test/setup_helper.rb
rbs-2.0.0.pre1 lib/rbs/test/setup_helper.rb
rbs-1.8.1 lib/rbs/test/setup_helper.rb
rbs-1.8.0 lib/rbs/test/setup_helper.rb
rbs-1.7.1 lib/rbs/test/setup_helper.rb
rbs-1.7.0 lib/rbs/test/setup_helper.rb
rbs-1.7.0.beta.5 lib/rbs/test/setup_helper.rb
rbs-1.7.0.beta.4 lib/rbs/test/setup_helper.rb
rbs-1.7.0.beta.3 lib/rbs/test/setup_helper.rb