aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views/request/list.html.erb_spec.rb
diff options
context:
space:
mode:
authorHenare Degan <henare.degan@gmail.com>2013-02-27 10:34:47 +1100
committerHenare Degan <henare.degan@gmail.com>2013-02-27 10:34:47 +1100
commit835b51c1de0d49e652fe9c9a60f0974275de070c (patch)
tree0d64a841f28654a66556bcc0c0bb1153bae645a2 /spec/views/request/list.html.erb_spec.rb
parent77a284d6d088f7aa6d40810d46a39658fc6cf2cd (diff)
Rename ALL THE TEMPLATES!!1!!!one!!1!!
.rhtml is deprecated in favour of .erb in Rails 3
Diffstat (limited to 'spec/views/request/list.html.erb_spec.rb')
-rw-r--r--spec/views/request/list.html.erb_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/views/request/list.html.erb_spec.rb b/spec/views/request/list.html.erb_spec.rb
new file mode 100644
index 000000000..521d946bc
--- /dev/null
+++ b/spec/views/request/list.html.erb_spec.rb
@@ -0,0 +1,49 @@
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
+
+describe "request/list" do
+
+ before do
+ assign :page, 1
+ assign :per_page, 10
+ end
+
+ def make_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'),
+ :is_external? => false
+ ),
+ :incoming_message => nil, :is_incoming_message? => false,
+ :outgoing_message => nil, :is_outgoing_message? => false,
+ :comment => nil, :is_comment? => false,
+ :event_type => 'sent',
+ :created_at => Time.now - 4.days,
+ :search_text_main => ''
+ )
+ end
+
+ it "should be successful" do
+ assign :list_results, [ make_mock_event, make_mock_event ]
+ assign :matches_estimated, 2
+ assign :show_no_more_than, 100
+ render
+ response.should have_selector("div.request_listing")
+ response.should_not have_selector("p", :content => "No requests of this sort yet")
+ end
+
+ it "should cope with no results" do
+ assign :list_results, [ ]
+ assign :matches_estimated, 0
+ assign :show_no_more_than, 0
+ render
+ response.should have_selector("p", :content => "No requests of this sort yet")
+ response.should_not have_selector("div.request_listing")
+ end
+
+end
+