diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-02-03 13:38:59 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-02-03 13:38:59 +0000 |
commit | 44bb96d40758f3b8bb9da20e3037ff2f04e81327 (patch) | |
tree | 2f43c9c02205fec1fb68cdcb66735d5b1ee3172f /spec/helpers/link_to_helper_spec.rb | |
parent | 7ed887f0989425d9e412890800df05637b08c025 (diff) | |
parent | 14b5be69dc2dc3c4dd817feb0b5a8402fc343db4 (diff) |
Merge branch 'release/0.5'
Diffstat (limited to 'spec/helpers/link_to_helper_spec.rb')
-rw-r--r-- | spec/helpers/link_to_helper_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index aae00c298..3fa91a8f8 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -7,9 +7,14 @@ describe LinkToHelper do describe 'when creating a url for a request' do before do - ActionController::Routing::Routes.filters.clear @mock_request = mock_model(InfoRequest, :url_title => 'test_title') + @old_filters = ActionController::Routing::Routes.filters + ActionController::Routing::Routes.filters = RoutingFilter::Chain.new end + after do + ActionController::Routing::Routes.filters = @old_filters + end + it 'should return a path like /request/test_title' do request_url(@mock_request).should == '/request/test_title' @@ -20,5 +25,17 @@ describe LinkToHelper do end end + + describe "when appending something to a URL" do + it 'should append to things without query strings' do + main_url('/a', '.json').should == 'http://test.localdomain/a.json' + end + it 'should append to things with query strings' do + main_url('/a?z=1', '.json').should == 'http://test.localdomain/a.json?z=1' + end + it 'should fail silently with invalid URLs' do + main_url('/a?z=9%', '.json').should == 'http://test.localdomain/a?z=9%' + end + end end |