Class: RSpec::Core::Invocations::PrintVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/invocations.rb

Instance Method Summary collapse

Instance Method Details

#call(_options, _err, out) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/rspec/core/invocations.rb', line 55

def call(_options, _err, out)
  overall_version = RSpec::Core::Version::STRING
  unless overall_version =~ /[a-zA-Z]+/
    overall_version = overall_version.split('.').first(2).join('.')
  end

  out.puts "RSpec #{overall_version}"

  [:Core, :Expectations, :Mocks, :Rails, :Support].each do |const_name|
    lib_name = const_name.to_s.downcase
    begin
      require "rspec/#{lib_name}/version"
    rescue LoadError
      # Not worth mentioning libs that are not installed
      nil
    else
      out.puts "  - rspec-#{lib_name} #{RSpec.const_get(const_name)::Version::STRING}"
    end
  end

  0
end