aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/request_controller_spec.rb14
-rw-r--r--spec/controllers/user_controller_spec.rb12
-rw-r--r--spec/fixtures/info_requests.yml2
-rw-r--r--spec/fixtures/users.yml4
4 files changed, 17 insertions, 15 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 22f354cae..4d68c2b8c 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -53,28 +53,28 @@ describe RequestController, "when showing one request" do
fixtures :info_requests, :info_request_events, :public_bodies, :users, :incoming_messages, :outgoing_messages # all needed as integrating views
it "should be successful" do
- get :show, :id => 101
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
response.should be_success
end
it "should render with 'show' template" do
- get :show, :id => 101
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
response.should render_template('show')
end
it "should assign the request" do
- get :show, :id => 101
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
assigns[:info_request].should == info_requests(:fancy_dog_request)
end
it "should show incoming messages" do
- get :show, :id => 101
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
size_before = assigns[:info_request_events].size
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-plain.email', ir.incoming_email)
- get :show, :id => 101
+ get :show, :url_title => 'why_do_you_have_such_a_fancy_dog'
(assigns[:info_request_events].size - size_before).should == 1
end
end
@@ -141,7 +141,7 @@ describe RequestController, "when creating a new request" do
mail = deliveries[0]
mail.body.should =~ /This is a silly letter. It is too short to be interesting./
- response.should redirect_to(:controller => 'request', :action => 'show', :id => ir.id)
+ response.should redirect_to(:controller => 'request', :action => 'show', :url_title => ir.url_title)
end
it "should give an error if the same request is submitted twice" do
@@ -227,7 +227,7 @@ describe RequestController, "when sending a followup message" do
mail.body.should =~ /What a useless response! You suck./
mail.to_addrs.to_s.should == "FOI Person <foiperson@localhost>"
- response.should redirect_to(:controller => 'request', :action => 'show', :id => info_requests(:fancy_dog_request))
+ response.should redirect_to(:controller => 'request', :action => 'show', :url_title => info_requests(:fancy_dog_request).url_title)
end
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 331428cf8..3bf7aaf51 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -5,27 +5,27 @@ describe UserController, "when showing a user" do
fixtures :users, :outgoing_messages, :incoming_messages, :info_requests, :info_request_events
it "should be successful" do
- get :show, :url_name => "bob-smith"
+ get :show, :url_name => "bob_smith"
response.should be_success
end
it "should redirect to lower case name if given one with capital letters" do
- get :show, :url_name => "Bob-Smith"
- response.should redirect_to(:controller => 'user', :action => 'show', :url_name => "bob-smith")
+ get :show, :url_name => "Bob_Smith"
+ response.should redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith")
end
it "should render with 'show' template" do
- get :show, :url_name => "bob-smith"
+ get :show, :url_name => "bob_smith"
response.should render_template('show')
end
it "should assign the user" do
- get :show, :url_name => "bob-smith"
+ get :show, :url_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, :url_name => "silly-emnameem"
+ get :show, :url_name => "silly_emnameem"
assigns[:display_users].should == [ users(:silly_name_user) ]
end
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index d9aa0d627..a849542b8 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -1,6 +1,7 @@
fancy_dog_request:
id: 101
title: Why do you have such a fancy dog?
+ url_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
public_body_id: 2
@@ -10,6 +11,7 @@ fancy_dog_request:
naughty_chicken_request:
id: 103
title: How much public money is wasted on breeding naughty chickens?
+ url_title: how_much_public_money_is_wasted_o
created_at: 2007-10-13 18:15:57
updated_at: 2007-10-13 18:15:57
public_body_id: 2
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index 9daa34bd0..f7ae3ba62 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -1,7 +1,7 @@
bob_smith_user:
id: "1"
name: Bob Smith
- url_name: bob-smith
+ url_name: bob_smith
email: bob@localhost
salt: "-6116981980.392287733335677"
hashed_password: 6b7cd45a5f35fd83febc0452a799530398bfb6e8 # jonespassword
@@ -11,7 +11,7 @@ bob_smith_user:
silly_name_user:
id: "2"
name: "Silly <em>Name</em>"
- url_name: silly-emnameem
+ url_name: silly_emnameem
email: silly@localhost
salt: "-6116981980.392287733335677"
hashed_password: 6b7cd45a5f35fd83febc0452a799530398bfb6e8 # jonespassword