سؤال

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].

  1. RSPEC 2
  2. RSPEC 3
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top