aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/controllers/body_controller_spec.rb7
-rw-r--r--spec/fixtures/public_bodies.yml2
-rw-r--r--spec/fixtures/public_body_versions.yml11
3 files changed, 18 insertions, 2 deletions
diff --git a/spec/controllers/body_controller_spec.rb b/spec/controllers/body_controller_spec.rb
index bf73a6e19..1dcc6d345 100644
--- a/spec/controllers/body_controller_spec.rb
+++ b/spec/controllers/body_controller_spec.rb
@@ -1,7 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe BodyController, "when showing a body" do
- fixtures :public_bodies
+ fixtures :public_bodies, :public_body_versions
it "should be successful" do
get :show, :simple_short_name => "dfh"
@@ -17,6 +17,11 @@ describe BodyController, "when showing a body" do
get :show, :simple_short_name => "dfh"
assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body) ]
end
+
+ it "should redirect to newest name if you use historic name of public body in URL" do
+ get :show, :simple_short_name => "hdink"
+ response.should redirect_to(:controller => 'body', :action => 'show', :simple_short_name => "dfh")
+ end
# XXX test for 404s when don't give valid name
# XXX test the fancy history searching stuff
diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml
index c8d95afc6..f77fc6eb1 100644
--- a/spec/fixtures/public_bodies.yml
+++ b/spec/fixtures/public_bodies.yml
@@ -16,7 +16,7 @@ humpadink_public_body:
complaint_email: humpadink-complaints@localhost
request_email: humpadink-requests@localhost
id: "3"
- version: "1"
+ version: "2"
last_edit_editor: "francis"
short_name: DfH
created_at: 2007-10-25 10:51:01.161639
diff --git a/spec/fixtures/public_body_versions.yml b/spec/fixtures/public_body_versions.yml
new file mode 100644
index 000000000..8efcc6846
--- /dev/null
+++ b/spec/fixtures/public_body_versions.yml
@@ -0,0 +1,11 @@
+humpadink_public_body_old1:
+ name: "Department for Humpadinking"
+ last_edit_comment: "Silly old abbrv"
+ updated_at: 2007-10-13 12:08:23.836085
+ complaint_email: humpadink-complaints@localhost
+ request_email: humpadink-requests@localhost
+ public_body_id: "3"
+ id: "5"
+ version: "1"
+ last_edit_editor: "francis"
+ short_name: HDINK