aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Houston <robin@lenny.robin>2011-07-14 00:28:45 +0100
committerRobin Houston <robin@lenny.robin>2011-07-14 00:28:45 +0100
commit75c70a460cbe8ff136cee6940c5c4d80d9a22b40 (patch)
tree3ea197f1925bc5d88383408933510bd2511c4d54
parent0560d4fd4287db43c99108a5acdf573d70f81044 (diff)
parentbb790631de2973f8009af558cc9d9a6a70a6efc9 (diff)
Merge branch 'master' of git@github.com:sebbacon/alaveteli into wdtk
-rw-r--r--app/views/request/_request_listing_single.rhtml10
-rw-r--r--spec/controllers/request_game_controller_spec.rb12
-rw-r--r--spec/views/request_game/play.rhtml_spec.rb37
3 files changed, 54 insertions, 5 deletions
diff --git a/app/views/request/_request_listing_single.rhtml b/app/views/request/_request_listing_single.rhtml
index 94a613a30..e8c1a393f 100644
--- a/app/views/request/_request_listing_single.rhtml
+++ b/app/views/request/_request_listing_single.rhtml
@@ -1,9 +1,9 @@
<div class="request_listing">
- <span class="head">
- <%= link_to h(info_request.title), (@play_urls ? "/categorise" : "") + request_url(info_request) %>
- </span>
- <span class="desc">
- <%= excerpt(info_request.initial_request_text, "", 150) %>
+ <span class="head">
+ <%= link_to h(info_request.title), (@play_urls ? request_path(:url_title => info_request.url_title) : request_url(info_request)) %>
+ </span>
+ <span class="desc">
+ <%= excerpt(info_request.initial_request_text, "", 150) %>
</span>
<span class="bottomline icon_<%= info_request.calculate_status %>">
<strong>
diff --git a/spec/controllers/request_game_controller_spec.rb b/spec/controllers/request_game_controller_spec.rb
new file mode 100644
index 000000000..eb05045e9
--- /dev/null
+++ b/spec/controllers/request_game_controller_spec.rb
@@ -0,0 +1,12 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe RequestGameController, "when playing the game" do
+
+ fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views
+
+ it "should show the game homepage with the correct urls" do
+ get :play
+ response.should render_template('play')
+ end
+end
+
diff --git a/spec/views/request_game/play.rhtml_spec.rb b/spec/views/request_game/play.rhtml_spec.rb
new file mode 100644
index 000000000..e90861e34
--- /dev/null
+++ b/spec/views/request_game/play.rhtml_spec.rb
@@ -0,0 +1,37 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe 'when viewing the request game' do
+
+ before do
+ @mock_body = mock_model(PublicBody, :name => 'test body',
+ :url_name => 'test_body',
+ :is_school? => false)
+ @mock_user = mock_model(User, :name => 'test user',
+ :url_name => 'test_user',
+ :profile_photo => nil)
+ @mock_request = mock_model(InfoRequest, :title => 'test request',
+ :awaiting_description => false,
+ :law_used_with_a => 'A Freedom of Information request',
+ :law_used_full => 'Freedom of Information',
+ :public_body => @mock_body,
+ :url_title => 'a_test_request',
+ :user => @mock_user,
+ :calculate_status => 'waiting_response',
+ :date_response_required_by => Date.today,
+ :prominence => 'normal',
+ :initial_request_text => 'hi there',
+ :display_status => 'Awaiting categorisation',
+ :created_at => Time.now)
+ assigns[:league_table_28_days] = []
+ assigns[:league_table_all_time] = []
+ assigns[:requests] = [@mock_request]
+ assigns[:play_urls] = true
+ end
+
+ it 'should show the correct url for a request' do
+ render "request_game/play"
+ response.should include_text("/categorise/request/a_test_request")
+ end
+
+
+end