aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/errors_spec.rb17
-rw-r--r--spec/integration/localisation_spec.rb29
2 files changed, 28 insertions, 18 deletions
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb
index 4fa12fb21..110626058 100644
--- a/spec/integration/errors_spec.rb
+++ b/spec/integration/errors_spec.rb
@@ -59,24 +59,20 @@ describe "When errors occur" do
response.should render_template('general/exception_caught')
response.code.should == '404'
response.body.should match("Sorry, we couldn't find that page")
- response.body.should match(%Q(invalid value for Integer))
end
- # it 'should handle non utf-8 parameters' do
- # pending 'until we sanitize non utf-8 parameters for Ruby >= 1.9' do
- # get ('/%d3')
- # response.should render_template('general/exception_caught')
- # response.code.should == '404'
- # response.body.should match("Sorry, we couldn't find that page")
- # end
- # end
+ it 'should handle non utf-8 parameters' do
+ get ('/%d3')
+ response.should render_template('general/exception_caught')
+ response.code.should == '404'
+ response.body.should match("Sorry, we couldn't find that page")
+ end
it "should render a 500 for general errors using the general/exception_caught template" do
InfoRequest.stub!(:find_by_url_title!).and_raise("An example error")
get("/request/example")
response.should render_template('general/exception_caught')
- response.body.should match('An example error')
response.code.should == "500"
end
@@ -111,7 +107,6 @@ describe "When errors occur" do
get("/es/request/example")
response.should render_template('general/exception_caught')
response.body.should match('Lo sentimos, hubo un problema procesando esta página')
- response.body.should match('An example error')
end
it "should render a 403 with text body for attempts at directory listing for attachments" do
diff --git a/spec/integration/localisation_spec.rb b/spec/integration/localisation_spec.rb
index 4f6b61ae1..037603ad5 100644
--- a/spec/integration/localisation_spec.rb
+++ b/spec/integration/localisation_spec.rb
@@ -24,14 +24,29 @@ describe "when generating urls" do
response.should_not contain @home_link_regex
end
- it 'should redirect requests for a public body in a locale to the canonical name in that locale' do
- get('/es/body/dfh')
- response.should redirect_to "/es/body/edfh"
- end
+ context 'when handling public body requests' do
+
+ before do
+ AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en')
+ body = FactoryGirl.create(:public_body, :short_name => 'english_short')
+ I18n.with_locale(:es) do
+ body.short_name = 'spanish_short'
+ body.save!
+ end
+ end
+
+ it 'should redirect requests for a public body in a locale to the
+ canonical name in that locale' do
+ get('/es/body/english_short')
+ response.should redirect_to "/es/body/spanish_short"
+ end
- it 'should remember a filter view when redirecting a public body request to the canonical name' do
- get('/es/body/tgq/successful')
- response.should redirect_to "/es/body/etgq/successful"
+ it 'should remember a filter view when redirecting a public body
+ request to the canonical name' do
+ AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en')
+ get('/es/body/english_short/successful')
+ response.should redirect_to "/es/body/spanish_short/successful"
+ end
end
describe 'when there is more than one locale' do