aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/body_controller_spec.rb
blob: 947c1de1c9828a88e3aa76e39b558cdc16166cdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require File.dirname(__FILE__) + '/../spec_helper'

describe BodyController, "when showing a body" do
    integrate_views
    fixtures :public_bodies, :public_body_versions
  
    it "should be successful" do
        get :show, :simple_short_name => "dfh"
        response.should be_success
    end

    it "should render with 'show' template" do
        get :show, :simple_short_name => "dfh"
        response.should render_template('show')
    end

    it "should assign the 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
end