I want to use Rspec for testing if a request thrown RecordNotFound
exception or not. I don't know what is the real differences between those two line of code, but one is work, and one is not.
This line is worked:
expect{get :show, params: {id: promotion.id + 1}}.to raise_exception(ActiveRecord::RecordNotFound)
But this line is not (using () instead of {})
expect(get :show, params: {id: promotion.id + 1}).to raise_exception(ActiveRecord::RecordNotFound)
However, I often use second line for another expect things such as:
it 'expect success' do
get :show, params: {id: product.id}
expect(response).to be_success
end
Please tell me what is the difference.