Sha256: 1558886e80f7aa2f412c9b2e66f315336b2522fb37b810426ad087b37e5b63bb
Contents?: true
Size: 1.32 KB
Versions: 12
Compression:
Stored size: 1.32 KB
Contents
require 'unit_spec_helper' describe Shoulda::Matchers::ActionController::RedirectToMatcher, type: :controller do context 'a controller that redirects' do it 'accepts redirecting to that url' do expect(controller_redirecting_to('/some/url')).to redirect_to('/some/url') end it 'rejects redirecting to a different url' do expect(controller_redirecting_to('/some/url')). not_to redirect_to('/some/other/url') end it 'accepts redirecting to that url in a block' do expect(controller_redirecting_to('/some/url')). to redirect_to('somewhere') { '/some/url' } end it 'rejects redirecting to a different url in a block' do expect(controller_redirecting_to('/some/url')). not_to redirect_to('somewhere else') { '/some/other/url' } end def controller_redirecting_to(url) build_fake_response { redirect_to url } end end context 'a controller that does not redirect' do it 'rejects redirecting to a url' do controller = build_fake_response { render text: 'hello' } expect(controller).not_to redirect_to('/some/url') end end it 'provides the correct description when provided a block' do matcher = redirect_to('somewhere else') { '/some/other/url' } expect(matcher.description).to eq 'redirect to "somewhere else"' end end
Version data entries
12 entries across 12 versions & 2 rubygems