Expect exceptions in rspec2 test

Donnerstag, 07. April 2011, 13:31 Uhr | roberto@vasquez-angel.de |

I keep forgetting how to test exceptions with rspec2. This is an example:

  describe "something" do
    describe "exceptions" do
      it "should raise an exception" do
        expect {
          # Code that throws an exception
        }.to raise_error
      end