aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorlouise <louise>2009-04-14 09:44:06 +0000
committerlouise <louise>2009-04-14 09:44:06 +0000
commit57b0fc86d03fe2ecf1036d6453391c4763eba6b4 (patch)
treea2bd61608415bc11299fbb8bef4852309438cb82 /spec
parent4108357ef0e4d5880145cfe7ae853f2188facc10 (diff)
Moving view specs to more standard place, moving helper method inside spec scope - will run more reliably when specs run in different orders
Diffstat (limited to 'spec')
-rw-r--r--spec/views/request/list.rhtml_spec.rb (renamed from spec/views/request_view_spec.rb)42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/views/request_view_spec.rb b/spec/views/request/list.rhtml_spec.rb
index c20023e6a..b171c5815 100644
--- a/spec/views/request_view_spec.rb
+++ b/spec/views/request/list.rhtml_spec.rb
@@ -1,7 +1,7 @@
-require File.dirname(__FILE__) + '/../spec_helper'
+require File.dirname(__FILE__) + '/../../spec_helper'
describe "when listing recent requests" do
-
+
before do
@xap = mock_model(ActsAsXapian::Search)
@xap.stub!(:matches_estimated).and_return(2)
@@ -13,12 +13,30 @@ describe "when listing recent requests" do
assigns[:page] = 1
assigns[:per_page] = 10
end
+
+ def mock_event
+ return mock_model(InfoRequestEvent,
+ :info_request => mock_model(InfoRequest,
+ :title => 'Title',
+ :url_title => 'title',
+ :display_status => 'awaiting_response',
+ :calculate_status => 'awaiting_response',
+ :public_body => mock_model(PublicBody, :name => 'Test Quango', :url_name => 'testquango'),
+ :user => mock_model(User, :name => 'Test User', :url_name => 'testuser')
+ ),
+ :incoming_message => nil,
+ :outgoing_message => nil,
+ :comment => nil,
+ :event_type => 'sent',
+ :created_at => Time.now - 4.days,
+ :search_text_main => ''
+ )
+ end
it "should be successful" do
render "request/list"
response.should have_tag("div.request_listing")
response.should_not have_tag("p", /No requests of this sort yet/m)
-
end
it "should cope with no results" do
@@ -30,21 +48,3 @@ describe "when listing recent requests" do
end
-def mock_event
- return mock_model(InfoRequestEvent,
- :info_request => mock_model(InfoRequest,
- :title => 'Title',
- :url_title => 'title',
- :display_status => 'awaiting_response',
- :calculate_status => 'awaiting_response',
- :public_body => mock_model(PublicBody, :name => 'Test Quango', :url_name => 'testquango'),
- :user => mock_model(User, :name => 'Test User', :url_name => 'testuser')
- ),
- :incoming_message => nil,
- :outgoing_message => nil,
- :comment => nil,
- :event_type => 'sent',
- :created_at => Time.now - 4.days,
- :search_text_main => ''
- )
-end