What is it_behaves_like?
e.g.
RSpec.describe Hoge, type: :model do
describe "model validation" do
subject { new_comment.validate! }
let(:new_comment) { build :comment }
describe "comment" do
context "コメントが空白" do
before { new_comment.comment = "" }
it_behaves_like "raise record invalid error"
end
...
What?
it_behaves_like
will call the test-case as template.
Grep your project with the word shared_examples
and get it like below:
shared_examples "raise record invalid error" do
it { expect(&method(:subject)).to raise_error(ActiveRecord::RecordInvalid) }
end