diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 3 | ||||
-rw-r--r-- | spec/helpers/link_to_helper_spec.rb | 42 | ||||
-rw-r--r-- | spec/models/request_mailer_spec.rb | 12 | ||||
-rw-r--r-- | spec/views/request/show.rhtml_spec.rb | 4 |
4 files changed, 5 insertions, 56 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index c785960b5..5505afe59 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -57,7 +57,6 @@ end describe TrackController, "when sending alerts for a track" do integrate_views - include LinkToHelper # for main_url before(:each) do load_raw_emails_data @@ -105,7 +104,7 @@ describe TrackController, "when sending alerts for a track" do # Given we can't click the link, check the token is right instead post_redirect = PostRedirect.find_by_email_token(mail_token) - expected_url = main_url("/user/" + users(:silly_name_user).url_name + "#email_subscriptions") # XXX can't call URL making functions here, what is correct way to do this? + expected_url = show_user_url(:url_name => users(:silly_name_user).url_name, :anchor => "email_subscriptions") post_redirect.uri.should == expected_url # Check nothing more is delivered if we try again diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index 030fd612d..3e997f9f9 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -17,27 +17,15 @@ describe LinkToHelper do it 'should return a path like /request/test_title' do - request_url(@mock_request).should == '/request/test_title' + request_path(@mock_request).should == '/request/test_title' end it 'should return a path including any extra parameters passed' do - request_url(@mock_request, {:update_status => 1}).should == '/request/test_title?update_status=1' + request_path(@mock_request, {:update_status => 1}).should == '/request/test_title?update_status=1' 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.host/a.json' - end - it 'should append to things with query strings' do - main_url('/a?z=1', '.json').should == 'http://test.host/a.json?z=1' - end - it 'should fail silently with invalid URLs' do - main_url('/a?z=9%', '.json').should == 'http://test.host/a?z=9%' - end - end - describe 'when displaying a user admin link for a request' do it 'should return the text "An anonymous user (external)" in the case where there is no external username' do @@ -48,32 +36,6 @@ describe LinkToHelper do end - describe 'admin_url' do - context 'with no ADMIN_BASE_URL set' do - it 'should prepend the admin general index path to a simple string' do - admin_url('unclassified').should == 'http://test.host/en/admin/unclassified' - end - - it 'should prepend the admin general index path to a deeper URL' do - admin_url('request/show/123').should == 'http://test.host/en/admin/request/show/123' - end - end - - context 'with ADMIN_BASE_URL set' do - before(:each) do - Configuration::should_receive(:admin_base_url).and_return('https://www.example.com/secure/alaveteli-admin/') - end - - it 'should prepend the admin base URL to a simple string' do - admin_url('unclassified').should == 'https://www.example.com/secure/alaveteli-admin/unclassified' - end - - it 'should prepend the admin base URL to a deeper URL' do - admin_url('request/show/123').should == 'https://www.example.com/secure/alaveteli-admin/request/show/123' - end - end - end - describe 'simple_date' do it 'should respect time zones' do Time.use_zone('Australia/Sydney') do diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index 000a0c12e..dd5a322fb 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -366,16 +366,4 @@ describe RequestMailer, 'requires_admin' do mail.body.should include('http://test.host/en/admin/request/show/123') end - - context 'has an ADMIN_BASE_URL set' do - before(:each) do - Configuration::should_receive(:admin_base_url).and_return('http://our.proxy.server/admin/alaveteli/') - end - - it 'body should contain the full admin URL' do - mail = RequestMailer.deliver_requires_admin(@info_request) - - mail.body.should include('http://our.proxy.server/admin/alaveteli/request/show/123') - end - end end diff --git a/spec/views/request/show.rhtml_spec.rb b/spec/views/request/show.rhtml_spec.rb index 4429e9e58..a22f29951 100644 --- a/spec/views/request/show.rhtml_spec.rb +++ b/spec/views/request/show.rhtml_spec.rb @@ -98,7 +98,7 @@ describe 'when viewing an information request' do it 'should show a link to follow up the last response with clarification' do request_page - expected_url = "http://test.host/request/#{@mock_request.id}/response/#{@mock_response.id}#followup" + expected_url = "/request/#{@mock_request.id}/response/#{@mock_response.id}#followup" response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message') end @@ -118,7 +118,7 @@ describe 'when viewing an information request' do it 'should show a link to follow up the request without reference to a specific response' do request_page - expected_url = "http://test.host/request/#{@mock_request.id}/response#followup" + expected_url = "/request/#{@mock_request.id}/response#followup" response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message') end end |