Sha256: d612a93058864ffae2f8671e8551b35183ac96b7379eb1f9449ea3790728de0a

Contents?: true

Size: 1001 Bytes

Versions: 6

Compression:

Stored size: 1001 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

6 entries across 6 versions & 1 rubygems

Version Path
rbs-0.13.1 lib/rbs/test/setup_helper.rb
rbs-0.13.0 lib/rbs/test/setup_helper.rb
rbs-0.12.2 lib/rbs/test/setup_helper.rb
rbs-0.12.1 lib/rbs/test/setup_helper.rb
rbs-0.12.0 lib/rbs/test/setup_helper.rb
rbs-0.11.0 lib/rbs/test/setup_helper.rb