aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/body_controller_spec.rb23
-rw-r--r--spec/controllers/user_controller_spec.rb27
-rw-r--r--spec/fixtures/users.yml9
3 files changed, 58 insertions, 1 deletions
diff --git a/spec/controllers/body_controller_spec.rb b/spec/controllers/body_controller_spec.rb
new file mode 100644
index 000000000..bf73a6e19
--- /dev/null
+++ b/spec/controllers/body_controller_spec.rb
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe BodyController, "when showing a body" do
+ fixtures :public_bodies
+
+ 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
+
+ # XXX test for 404s when don't give valid name
+ # XXX test the fancy history searching stuff
+end
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
new file mode 100644
index 000000000..8354e774c
--- /dev/null
+++ b/spec/controllers/user_controller_spec.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe UserController, "when showing a user" do
+ fixtures :users
+
+ it "should be successful" do
+ get :show, :simple_name => "bob_smith"
+ response.should be_success
+ end
+
+ it "should render with 'show' template" do
+ get :show, :simple_name => "bob_smith"
+ response.should render_template('show')
+ end
+
+ it "should assign the user" do
+ get :show, :simple_name => "bob-smith"
+ assigns[:display_users].should == [ users(:bob_smith_user) ]
+ end
+
+ it "should assign the user for a more complex name" do
+ get :show, :simple_name => "silly-emnameem"
+ assigns[:display_users].should == [ users(:silly_name_user) ]
+ end
+
+ # XXX test for 404s when don't give valid name
+end
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index c28c67de2..842c71b68 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -6,5 +6,12 @@ bob_smith_user:
hashed_password: 6b7cd45a5f35fd83febc0452a799530398bfb6e8 # jonespassword
updated_at: 2007-10-31 10:39:15.491593
created_at: 2007-10-31 10:39:15.491593
-
+silly_name_user:
+ id: "2"
+ name: "Silly <em>Name</em>"
+ email: silly@localhost
+ salt: "-6116981980.392287733335677"
+ hashed_password: 6b7cd45a5f35fd83febc0452a799530398bfb6e8 # jonespassword
+ updated_at: 2007-11-01 10:39:15.491593
+ created_at: 2007-11-01 10:39:15.491593