申し訳ありませんが、タイトルの言い方がわかりませんが、テストの概要は次のとおりです。
describe Model do
let(:model) { FactoryGirl.create(:model) }
subject { model }
it { should be_valid }
model.array_attribute.each do |attribute|
context "description" do
specify { attribute.should == 1 }
end
end
end
問題は、その行model.array_attribute.each do |attribute|
で、未定義のローカル変数またはメソッドのエラーが発生することmodel
です。let(:model)
検証が(とりわけ)正常に機能するため、が機能していることを私は知っています。この問題は、実際のテスト(つまりspecify
、it
など)の外部で呼び出されていることが原因であると思われます。
これを機能させる方法について何かアイデアはありますか?