نتائج rspec المعلقة في اختبار خاطئ
-
21-12-2019 - |
سؤال
it 'should be an array and not be empty' do
pending
expect(a.class).to be(Array)
expect(a.empty?).to be(false)
expect(a.first.class).to be(ExampleClass)
end
عندما أقوم بتشغيل rspec:
Failures:
1) should be an array and not be empty FIXED
Expected pending 'No reason given' to fail. No Error was raised.
# ./spec/example_spec.rb:19
هل هناك أي أفكار لماذا يتم إدراج هذا على أنه فاشل؟
المحلول
اعتبارًا من Rspec 3.x، يتم تشغيل المواصفات المعلقة فعليًا، وإذا تم اجتيازها، فسيتم اعتبارها فشلًا (لأنه إذا تم اجتيازها، فإن Rspec يعتقد أنها لا ينبغي أن تكون معلقة).
يمكنك استخدام skip
بدلاً من pending
للتأكد من أن المواصفات الخاصة بك لا تعمل فعليًا.
مزيد من المعلومات: http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#changes_to__semantics_and_introduction_of_
نصائح أخرى
ها هي دليلك:
giveacodicetagpre.الأشياء التي تمر تسبب اختبار معلقة للفشل.تحقق من المستندات للحصول على أمثلة [1]، [2].
- RSPEC 2
- RSPEC 3
لا تنتمي إلى StackOverflow