diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-03-25 15:20:59 +0000 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-03-25 15:20:59 +0000 |
commit | 2bb79f893805e972f6efe5cb7cfe90dd0efa4107 (patch) | |
tree | 47084acc8d48126b9e891bb50c217be43be27641 /spec/controllers/admin_public_body_controller_spec.rb | |
parent | 22c25e42847d41924d43d31f3ef67be1ae4a155e (diff) | |
parent | 1fb57d66c22000d4164c033ffd9353aa9030255b (diff) |
resolve merge conflicts
Diffstat (limited to 'spec/controllers/admin_public_body_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin_public_body_controller_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index db2e449f8..a48367ae1 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -43,3 +43,57 @@ describe AdminPublicBodyController, "when administering public bodies" do end + +describe AdminPublicBodyController, "when administering public bodies with i18n" do + integrate_views + fixtures :public_bodies, :public_body_translations + + it "shows the index page" do + get :index + end + + it "searches for 'humpa'" do + get :index, {:query => "humpa", :locale => "es"} + assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body) ] + end + + it "shows a public body" do + get :show, {:id => 2, :locale => "es" } + end + + it "creates a new public body" do + PublicBody.count.should == 2 + post :create, { :public_body => { :name => "New Quango", :short_name => "", :tag_string => "blah", :request_email => 'newquango@localhost', :last_edit_comment => 'From test code' } } + PublicBody.count.should == 3 + end + + it "edits a public body" do + get :edit, {:id => 3, :locale => 'es'} + response.body.should include('Baguette') + end + + it "saves edits to a public body" do + PublicBody.with_locale(:es) do + pb = PublicBody.find(id=3) + pb.name.should == "El Department for Humpadinking" + end + + post :update, { :id => 3, :public_body => { :name => "Renamed", :short_name => "", :tag_string => "some tags", :request_email => 'edited@localhost', :last_edit_comment => 'From test code' }, :locale => "es" } + response.flash[:notice].should include('successful') + pb = PublicBody.find(public_bodies(:humpadink_public_body).id) + PublicBody.with_locale(:es) do + pb.name.should == "Renamed" + end + PublicBody.with_locale(:en) do + pb.name.should == "Department for Humpadinking" + end + end + + it "destroy a public body" do + PublicBody.count.should == 2 + post :destroy, { :id => 3 } + PublicBody.count.should == 1 + end + + +end |