SORU
12 Kasım 2009, PERŞEMBE


Nasıl rspec'In should_raise hariç her türlü ile kullanmak için?

Böyle bir şey yapmak istiyorum:

some_method.should_raise <any kind of exception, I don't care>

Bu ne yapmalıyım?

some_method.should_raise exception

... çalışmıyor.

CEVAP
12 Kasım 2009, PERŞEMBE


expect { some_method }.to raise_error

1 Sözdizimi RSpec:

lambda { some_method }.should raise_error

Daha fazlası için* *8 (RSpec 1 sözdizimi) ve RSpec 2 documentation bkz.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • L- Crysis

    L- Crysis

    30 Aralık 2011
  • thewinekone

    thewinekone

    17 Aralık 2005
  • Within Temptation

    Within Tempt

    18 EYLÜL 2006