diff options
author | Robin Houston <robin.houston@gmail.com> | 2011-12-30 16:49:50 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2011-12-30 16:49:50 +0000 |
commit | 5eb2396a036f3a7400957e86dad8a74482224717 (patch) | |
tree | b790f045ac8d320215f8cc67f6b084c820691441 /spec/controllers/public_body_controller_spec.rb | |
parent | d941232e838ede8ef0de20d4cb4557bc3698b510 (diff) | |
parent | 79fd89c5aec01ea035d57c5a71213202dafc778c (diff) |
Merge branch 'develop' of github.com:sebbacon/alaveteli into develop
Diffstat (limited to 'spec/controllers/public_body_controller_spec.rb')
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 53e6c169a..8182e1331 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -68,17 +68,19 @@ describe PublicBodyController, "when listing bodies" do response.should be_success end - it "should list all bodies even when there are no translations for selected locale" do + it "should list all bodies from default locale, even when there are no translations for selected locale" do + PublicBody.with_locale(:en) do + english_only = PublicBody.new(:name => 'English only', + :short_name => 'EO', + :request_email => 'english@flourish.org', + :last_edit_editor => 'test', + :last_edit_comment => '') + english_only.save + end PublicBody.with_locale(:es) do - - spanish_only = PublicBody.new(:name => 'Spanish only', - :short_name => 'SO', - :request_email => 'spanish@flourish.org', - :last_edit_editor => 'test', - :last_edit_comment => '') - end - get :list - assigns[:public_bodies].length.should == 3 + get :list + assigns[:public_bodies].length.should == 3 + end end it "should list bodies in alphabetical order" do @@ -175,7 +177,7 @@ describe PublicBodyController, "when doing type ahead searches" do it "should return nothing for the empty query string" do get :search_typeahead, :q => "" response.should render_template('public_body/_search_ahead') - assigns[:xapian_requests].results.size.should == 0 + assigns[:xapian_requests].should be_nil end it "should return a body matching the given keyword, but not users with a matching description" do @@ -200,10 +202,9 @@ describe PublicBodyController, "when doing type ahead searches" do assigns[:xapian_requests].results[0][:model].name.should == public_bodies(:humpadink_public_body).name end - it "should return partial matches" do - get :search_typeahead, :q => "geral" # 'geral' for 'Geraldine' + it "should not return matches for short words" do + get :search_typeahead, :q => "b" response.should render_template('public_body/_search_ahead') - assigns[:xapian_requests].results.size.should == 1 - assigns[:xapian_requests].results[0][:model].name.should == public_bodies(:geraldine_public_body).name + assigns[:xapian_requests].should be_nil end end |