Module: RBS::Test::SetupHelper

Defined in:
lib/rbs/test/setup_helper.rb

Defined Under Namespace

Classes: InvalidSampleSizeError

Constant Summary collapse

DEFAULT_SAMPLE_SIZE =
100

Instance Method Summary collapse

Instance Method Details

#get_sample_size(string) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rbs/test/setup_helper.rb', line 17

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

#to_double_class(double_suite) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rbs/test/setup_helper.rb', line 30

def to_double_class(double_suite)
  return nil unless double_suite

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