diff options
-rw-r--r-- | app/models/info_request.rb | 3 | ||||
-rw-r--r-- | spec/controllers/admin_public_body_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/fixtures/info_requests.yml | 17 | ||||
-rw-r--r-- | spec/fixtures/public_bodies.yml | 3 | ||||
-rw-r--r-- | spec/models/info_request_spec.rb | 22 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 4 | ||||
-rw-r--r-- | spec/spec.opts | 2 | ||||
-rw-r--r-- | todo.txt | 3 |
8 files changed, 41 insertions, 15 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 7261978da..8efd40497 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.9 2007-10-30 15:03:03 francis Exp $ +# $Id: info_request.rb,v 1.10 2007-10-30 20:02:28 francis Exp $ require 'digest/sha1' @@ -24,6 +24,7 @@ class InfoRequest < ActiveRecord::Base # the format PREFIXrequest-ID-HASH@DOMAIN. Here ID is the id of the # FOI request, and HASH is a signature for that id. def incoming_email + raise "id required to make incoming_email" if not self.id incoming_email = MySociety::Config.get("INCOMING_EMAIL_PREFIX", "") incoming_email += "request-" + self.id.to_s incoming_email += "-" + Digest::SHA1.hexdigest(self.id.to_s + MySociety::Config.get("INCOMING_EMAIL_SECRET"))[0,8] diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index 87f7e1185..f696c6f8a 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../spec_helper' -describe AdminPublicBodyController, "#route_for" do +describe AdminPublicBodyController, "when routing requests" do it "should map { :controller => 'admin_public_body', :action => 'list' } to /admin/body/list" do route_for(:controller => "admin_public_body", :action => "list").should == "/admin/body/list" diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml index b99c4d5b8..b0cd456e3 100644 --- a/spec/fixtures/info_requests.yml +++ b/spec/fixtures/info_requests.yml @@ -1,10 +1,11 @@ -new_request: - id: 1 - title: New Request - created_at: 2007-10-13 18:15:57 - updated_at: 2007-10-13 18:15:57 -rejected_request: - id: 2 - title: Rejected Request +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 + diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml index 2154b0664..fe0b8b4f4 100644 --- a/spec/fixtures/public_bodies.yml +++ b/spec/fixtures/public_bodies.yml @@ -1,5 +1,4 @@ ---- !ruby/object:PublicBody -attributes: +new_public_body: name: The Geraldine Quango updated_at: 2007-10-24 10:51:01.161639 last_edit_comment: Mark named this stupid quango. diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb new file mode 100644 index 000000000..353ef3243 --- /dev/null +++ b/spec/models/info_request_spec.rb @@ -0,0 +1,22 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +describe InfoRequest, " when emailing" do + fixtures :info_requests + + before do + @info_request = info_requests(:fancy_dog_request) + end + + it "should have a valid incoming email" do + @info_request.incoming_email.should_not be_nil + end + + it "should recognise its own incoming email" do + incoming_email = @info_request.incoming_email + found_info_request = InfoRequest.find_by_incoming_email(incoming_email) + found_info_request.should ==(@info_request) + end + +end + + diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 879006b4b..b4b4cfc13 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -12,4 +12,6 @@ describe User, " when authenticating" do @user.hashed_password.should_not be_nil end -end
\ No newline at end of file +end + + diff --git a/spec/spec.opts b/spec/spec.opts index d8c8db5d4..e9b65f0ac 100644 --- a/spec/spec.opts +++ b/spec/spec.opts @@ -1,6 +1,6 @@ --colour --format -progress +specdoc --loadby mtime --reverse @@ -1,4 +1,5 @@ Send confirmation email +Send email to requestor telling them new information has come in Make it say "dear" as default letter @@ -10,7 +11,7 @@ Use something other than session for post redirect store, so can go via email If you recently made a request, then a login will try to make it again because all the stuff for the post redirect is in the session. Consider again -Write some tests (try it their way, at every level) +Write some tests (using rspec) Tidying ======= |