RSpec / RSpec Mocks / Docs / Command line
This page comes from RSpec Mocks 2.7.1. It is not part of the 3.12.4 docs. See the latest RSpec Mocks docs.
run with ruby command
You can use the ruby command to run specs. You just need to require rspec/autorun.
Generally speaking, you're better off using the rspec command, which requires rspec/autorun for you, but some tools only work with the ruby command.
Scenario:
- Given a file named "
example_spec.rb" with:rubyrequire 'rspec/autorun' describe 1 do it "is < 2" do 1.should be < 2 end end - When I run `ruby example_spec.rb`
- Then the output should contain "
1 example, 0 failures"
Source: features/command_line/ruby.feature at v2.7.1, RSpec Mocks (MIT license).