単一のオブジェクトではなく、一連のオブジェクトをより正確に参照する一連の例があります。「they 'should do/be x'」の方が理にかなっています。例えば:
describe ArrayElements do
they 'are ordered' do
...
end
they { should all_be_identical }
end
それらを受け入れるようにRSpec 3を構成することは可能ですか?
rspec を構成するときに (たとえば、spec_helper.rb で) をit
使用して、エイリアスを構成できます。alias_example_to
Rspec.configure do |config|
config.alias_example_to :they
end
これを使用して、この方法で作成されたすべての例にメタデータを設定することもできます。たとえば、
Rspec.configure do |config|
config.alias_example_to :they, :type => :collection
end
context/describe のエイリアスを作成することもできます。alias_example_group_to