diff --git a/spec/support/controllers.rb b/spec/support/controllers.rb index 6688a4b7..6101e91c 100644 --- a/spec/support/controllers.rb +++ b/spec/support/controllers.rb @@ -37,8 +37,12 @@ def expect_json expect_content_type('application/json') end -def expect_redirect(path = nil) - if path +def expect_redirect(path = nil, &) + if block_given? + it 'performs a redirect to the location given' do + expect(controller).to redirect_to(instance_eval(&)) + end + elsif path it "redirects to #{path}" do expect(controller).to redirect_to(path) end