diff options
author | Henare Degan <henare.degan@gmail.com> | 2012-10-04 14:11:31 +1000 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2012-10-04 14:25:39 +1000 |
commit | 93dfbe495b5fb5e21b5fdf16a1c325a9eb8faa12 (patch) | |
tree | 5c82103defdfad577392b1afdfd5840fcf7bc22d | |
parent | 8e1f964b0fde69101ffaf7d08355448d1ff823ce (diff) |
Describe the current behavior of admin_url
-rw-r--r-- | spec/helpers/link_to_helper_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
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 |