diff options
| -rw-r--r-- | app/views/request/_request_listing_single.rhtml | 10 | ||||
| -rw-r--r-- | config/routes.rb | 2 | ||||
| -rw-r--r-- | spec/controllers/request_game_controller_spec.rb | 12 | ||||
| -rw-r--r-- | spec/views/request_game/play.rhtml_spec.rb | 37 | 
4 files changed, 55 insertions, 6 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/config/routes.rb b/config/routes.rb index 175a37a82..b3c0d4a7b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -195,7 +195,7 @@ ActionController::Routing::Routes.draw do |map|          rule.admin_rule_update '/admin/censor/update', :action => 'update'          rule.admin_rule_destroy '/admin/censor/destroy/:censor_rule_id', :action => 'destroy'      end -    map.filter('locale') +    #map.filter('locale')      # Allow downloading Web Service WSDL as a file with an extension 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 | 
