1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# subjectがArrayクラスであることを検証する
it { is_expected.to be_kind_of Array }
# 全要素がHashであることを検証する
it { is_expected.to all(be_kind_of Hash) }
# ハッシュの中身について検証する
it '各パラメータの値' do
expect(Article.first.attributes.deep_symbolize_keys).to match(
title: be_a(String),
position: be_an(Integer),
body: start_with('こんにちは'),
environment: be_in(['development', 'test', 'production']),
published: be_in([true, false]),
)
end
|