Why do we sometimes need to install a miniature stone?

I am using Ruby 2.0.

Sometimes I come across cases where I can’t just simply require 'minitest'. It gives me

irb> require 'minitest'
LoadError: cannot load such file -- minitest
from rubygems/core_ext/kernel_require.rb:55:in `require'

I need to install a miniature stone first. However, I thought minitest was part of the Ruby standard library.

When do we need to explicitly set a miniature stone through gem installor Gemfile?

If installation is explicitly required, should the gemfile bundle installexceed gem install?

Update

I myself use rbenv. I also install my Ruby through rbenv.
My ruby ​​version is ruby ​​2.0.0p353 (version 2013-11-22 43784) [x86_64-darwin13.0.2]

+4
source share
2 answers

, , MiniTest 4.x 5.x - 5.x, , 4.x.

:

irb> require 'minitest'
=> true
irb> require 'minitest/autorun'
=> true
irb> MiniTest::Test
=> Minitest::Test
irb> MiniTest.constants
=> [:Parallel, :VERSION, :Runnable, :AbstractReporter, :Reporter, :ProgressReporter, :StatisticsReporter, :SummaryReporter, :CompositeReporter, :Assertion, :Skip, :UnexpectedError, :Guard, :BacktraceFilter, :Test, :Assertions, :Unit, :Spec, :Expectations, :Mock]
irb> MiniTest::Unit::VERSION
=> "5.3.2"

. Ruby 2.1 .

irb> require 'minitest'
LoadError: cannot load such file -- minitest
irb> require 'minitest/autorun'
=> true
irb> MiniTest::Test
NameError: uninitialized constant MiniTest::Test
irb> MiniTest.constants
=> [:Assertion, :Skip, :BacktraceFilter, :Assertions, :Unit, :Spec, :Expectations, :Mock]
irb> MiniTest::Unit::VERSION
=> "4.7.5"

, , minitest, 5 Gemfile/bundler.

+3

, . , , gem .

sunspot_rails
  nokogiri (>= 1.2.0)

webrat
  nokogiri (>= 1.3) 

nokogiri, . , gem, . bundle .

+1

Source: https://habr.com/ru/post/1536551/


All Articles