From 93dfbe495b5fb5e21b5fdf16a1c325a9eb8faa12 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Thu, 4 Oct 2012 14:11:31 +1000 Subject: Describe the current behavior of admin_url --- spec/helpers/link_to_helper_spec.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'spec/helpers/link_to_helper_spec.rb') diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index 9ec0afce1..582fe24d4 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -48,4 +48,29 @@ 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 == '/admin/unclassified' + end + + it 'should prepend the admin general index path to a deeper URL' do + admin_url('request/show/123').should == '/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 end -- cgit v1.2.3 From 38a64203dd2e875e92c4bf4e5cd48ff59cd49526 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Thu, 4 Oct 2012 14:58:01 +1000 Subject: Correct default value for ADMIN_BASE_URL Back in 008e64e7 it was changed so that you could just set a blank value instead of '/admin/', it looks like test.yml was never updated and somehow lib/configuration.rb started off with the old value too. --- spec/helpers/link_to_helper_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/helpers/link_to_helper_spec.rb') diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index 582fe24d4..098fba008 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -51,11 +51,11 @@ describe LinkToHelper do 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 == '/admin/unclassified' + admin_url('unclassified').should == '/en/admin/unclassified' end it 'should prepend the admin general index path to a deeper URL' do - admin_url('request/show/123').should == '/admin/request/show/123' + admin_url('request/show/123').should == '/en/admin/request/show/123' end end -- cgit v1.2.3 From 2ce05f2d6eb33f5ac4c3a27312f97b79624aa48f Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Thu, 4 Oct 2012 15:13:20 +1000 Subject: Change the behaviour of admin_url to always return a full URL --- spec/helpers/link_to_helper_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/helpers/link_to_helper_spec.rb') diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index 098fba008..ef89e8bf9 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -51,11 +51,11 @@ describe LinkToHelper do 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 == '/en/admin/unclassified' + 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 == '/en/admin/request/show/123' + admin_url('request/show/123').should == 'http://test.host/en/admin/request/show/123' end end -- cgit v1.2.3