- 構文
bin/rspec file_path:line number
- 例
下記specの11行目のみをテストする場合
1 require 'rails_helper'
2
3 describe String do
4 describe '#<<' do
5 example '文字の追加' do
6 s = "ABC"
7 s << "D"
8 expect(s.size).to eq(4)
9 end
10
11 example 'nilは追加できない' do
12 s = "ABC"
13 expect { s << nil }.to raise_error(TypeError)
14 end
15 end
16 end
bin/rspec spec/experiments/string_spec.rb:11