aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/admin_request/edit_outgoing.rhtml2
-rw-r--r--app/views/admin_request/list.rhtml6
-rw-r--r--app/views/admin_request/show.rhtml6
-rw-r--r--app/views/admin_user/list.rhtml4
-rw-r--r--app/views/help/about.rhtml2
-rw-r--r--app/views/help/contact.rhtml2
-rw-r--r--spec/controllers/admin_request_controller_spec.rb40
-rw-r--r--spec/controllers/admin_user_controller_spec.rb21
-rw-r--r--spec/controllers/help_controller_spec.rb30
9 files changed, 101 insertions, 12 deletions
diff --git a/app/views/admin_request/edit_outgoing.rhtml b/app/views/admin_request/edit_outgoing.rhtml
index 099658e44..d516396bd 100644
--- a/app/views/admin_request/edit_outgoing.rhtml
+++ b/app/views/admin_request/edit_outgoing.rhtml
@@ -16,7 +16,7 @@
<p>You could also use this to edit a message before resending it, but
only the edited version will be shown on the public page if you do that.</p>
- <%= submit_tag 'Save' %>
+ <p><%= submit_tag 'Save' %></p>
<% end %>
<p>
diff --git a/app/views/admin_request/list.rhtml b/app/views/admin_request/list.rhtml
index 9f0ead369..b2874f965 100644
--- a/app/views/admin_request/list.rhtml
+++ b/app/views/admin_request/list.rhtml
@@ -3,10 +3,10 @@
<h1><%=@title%></h1>
<% form_tag("") do %>
- </p>
+ <p>
<%= text_field_tag 'query', params[:query], { :size => 30 } %>
<%= submit_tag "Search" %> (substring search, titles only)
- <p>
+ </p>
<% end %>
<table>
@@ -28,5 +28,3 @@
<%= will_paginate(@info_requests) %>
-<br />
-
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index 940972187..2556513e6 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -37,8 +37,10 @@
<% end %>
<td>
<% form_tag '../resend' do %>
- <%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
- <%= submit_tag "Resend" %>
+ <div>
+ <%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
+ <%= submit_tag "Resend" %>
+ </div>
<% end %>
<%= link_to "Edit", '../edit_outgoing/' + outgoing_message.id.to_s %>
</td>
diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.rhtml
index 5a575bce2..b84b81b0a 100644
--- a/app/views/admin_user/list.rhtml
+++ b/app/views/admin_user/list.rhtml
@@ -21,7 +21,7 @@
<tr class="<%= cycle('odd', 'even') %>">
<td><%= user.id.to_s %></td>
<td><%= link_to h(user.name), 'show/' + user.id.to_s %></td>
- <td><a href="mailto:<%=h user.email %>"><%=h user.email%></td>
+ <td><a href="mailto:<%=h user.email %>"><%=h user.email%></a></td>
<% for column in ['created_at', 'updated_at', 'email_confirmed'] %>
<td><%=h user.send(column) %></td>
<% end %>
@@ -31,5 +31,3 @@
<%= will_paginate(@admin_users) %>
-<br />
-
diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml
index 3eef0b58a..453d8ab79 100644
--- a/app/views/help/about.rhtml
+++ b/app/views/help/about.rhtml
@@ -23,7 +23,7 @@ to the public authority. Any response they make is automatically published on th
website for you and anyone else to find and read.
</dd>
-<dt id="whybother_me">Why would I bother to do this?</a>
+<dt id="whybother_me">Why would I bother to do this?</dt>
<dd>You pay taxes, and then government does things with the money. All sorts of
things that affect your life, from healthcare through to national defence. Some
it does badly, some it does well. The more we find out about how government
diff --git a/app/views/help/contact.rhtml b/app/views/help/contact.rhtml
index e8ae88793..c197dc5bf 100644
--- a/app/views/help/contact.rhtml
+++ b/app/views/help/contact.rhtml
@@ -51,7 +51,7 @@
</p>
<p>
- <label class="form_label" for="outgoing_message_body">Message:</label>
+ <label class="form_label" for="contact_message">Message:</label>
<%= f.text_area :message, :rows => 5, :cols => 50 %>
</p>
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
new file mode 100644
index 000000000..1e05465de
--- /dev/null
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -0,0 +1,40 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe AdminRequestController, "when administering requests" do
+ integrate_views
+ fixtures :info_requests, :outgoing_messages
+
+ it "shows the index/list page" do
+ get :index
+ end
+
+ it "shows a public body" do
+ get :show, :id => info_requests(:fancy_dog_request)
+ end
+
+ it "edits a public body" do
+ get :edit, :id => info_requests(:fancy_dog_request)
+ end
+
+ it "saves edits to a request" do
+ info_requests(:fancy_dog_request).title.should == "Why do you have such a fancy dog?"
+ post :update, { :id => info_requests(:fancy_dog_request), :info_request => { :title => "Renamed", :prominence => "normal", :described_state => "waiting_response", :awaiting_description => false } }
+ response.flash[:notice].should include('successful')
+ ir = InfoRequest.find(info_requests(:fancy_dog_request).id)
+ ir.title.should == "Renamed"
+ end
+
+ it "edits an outgoing message" do
+ get :edit_outgoing, :id => outgoing_messages(:useless_outgoing_message)
+ end
+
+ it "saves edits to an outgoing_message" do
+ outgoing_messages(:useless_outgoing_message).body.should include("fancy dog")
+ post :update_outgoing, { :id => outgoing_messages(:useless_outgoing_message), :outgoing_message => { :body => "Why do you have such a delicious cat?" } }
+ response.flash[:notice].should include('successful')
+ ir = OutgoingMessage.find(outgoing_messages(:useless_outgoing_message).id)
+ ir.body.should include("delicious cat")
+ end
+
+end
+
diff --git a/spec/controllers/admin_user_controller_spec.rb b/spec/controllers/admin_user_controller_spec.rb
new file mode 100644
index 000000000..b3258b929
--- /dev/null
+++ b/spec/controllers/admin_user_controller_spec.rb
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe AdminUserController, "when administering users" do
+ integrate_views
+ fixtures :users
+
+ it "shows the index/list page" do
+ get :index
+ end
+
+ it "searches for 'bob'" do
+ get :list, :query => "bob"
+ assigns[:admin_users].should == [ users(:bob_smith_user) ]
+ end
+
+ it "shows a user" do
+ get :show, :id => users(:bob_smith_user)
+ end
+
+end
+
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
new file mode 100644
index 000000000..2743c9c77
--- /dev/null
+++ b/spec/controllers/help_controller_spec.rb
@@ -0,0 +1,30 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe HelpController, "when using help" do
+ integrate_views
+
+ it "shows the about page" do
+ get :about
+ end
+
+ it "shows contact form" do
+ get :contact
+ end
+
+ it "sends a contact message" do
+ post :contact, { :contact => {
+ :name => "Vinny Vanilli",
+ :email => "vinny@localhost",
+ :subject => "Why do I have such an ace name?",
+ :message => "You really should know!!!\n\nVinny",
+ }, :submitted_contact_form => 1
+ }
+ response.should redirect_to(:controller => 'general', :action => 'frontpage')
+
+ deliveries = ActionMailer::Base.deliveries
+ deliveries.size.should == 1
+ deliveries[0].body.should include("really should know")
+ end
+
+end
+