aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/controllers/request_controller_spec.rb26
-rw-r--r--spec/fixtures/info_requests.yml18
2 files changed, 35 insertions, 9 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
new file mode 100644
index 000000000..1195db34f
--- /dev/null
+++ b/spec/controllers/request_controller_spec.rb
@@ -0,0 +1,26 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe RequestController, "when listing all requests" do
+ fixtures :info_requests
+
+ it "should be successful" do
+ get :list
+ response.should be_success
+ end
+
+ it "should render with 'list' template" do
+ get :list
+ response.should render_template('list')
+ end
+
+ it "should assign the first page of results" do
+ # XXX probably should load more than one page of requests into db here :)
+
+ get :list
+ assigns[:info_requests] == [
+ info_requests(:fancy_dog_request),
+ info_requests(:naughty_chicken_request)
+ ]
+ end
+
+end
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index b0cd456e3..3bb7934ac 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -1,11 +1,11 @@
fancy_dog_request:
- id: 101
- title: Why do you have such a fancy dog?
- created_at: 2007-10-13 18:15:57
- updated_at: 2007-10-13 18:15:57
-# naughty_chicken_request:
-# id: 2
-# title: How much public money is wasted on breeding naughty chickens?
-# created_at: 2007-10-13 18:15:57
-# updated_at: 2007-10-13 18:15:57
+ id: 101
+ title: Why do you have such a fancy dog?
+ created_at: 2007-10-11 18:15:57
+ updated_at: 2007-10-11 18:15:57
+naughty_chicken_request:
+ id: 103
+ title: How much public money is wasted on breeding naughty chickens?
+ created_at: 2007-10-13 18:15:57
+ updated_at: 2007-10-13 18:15:57