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

  • boburnham

    boburnham

    11 Temmuz 2006
  • huyked

    huyked

    28 Mart 2008
  • PUSHER

    PUSHER

    11 HAZİRAN 2014