Debian Codegraph @

rspec-core/features/command_line/ruby.feature

raw
1 Feature: Run with `ruby` command
2
3 You can use the `ruby` command to run specs. You just need to require
4 `rspec/autorun`.
5
6 Generally speaking, you're better off using the `rspec` command, which avoids
7 the complexity of `rspec/autorun` (e.g. no `at_exit` hook needed!), but some
8 tools only work with the `ruby` command.
9
10 Scenario: Require `rspec/autorun` from a spec file
11 Given a file named "example_spec.rb" with:
12 """ruby
13 require 'rspec/autorun'
14
15 RSpec.describe 1 do
16 it "is < 2" do
17 expect(1).to be < 2
18 end
19
20 it "has an intentional failure" do
21 expect(1).to be > 2
22 end
23 end
24 """
25 When I run `ruby example_spec.rb`
26 Then the output should contain "2 examples, 1 failure"
27 And the output should contain "expect(1).to be > 2"