aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/general_controller_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-10-29 16:32:57 +0000
committerLouise Crow <louise.crow@gmail.com>2012-10-29 16:40:03 +0000
commita0af63713dc0e222c9b8230b2783653b9eb4680e (patch)
tree49787624376a355e61f28faaf1c08b1e4f479cb1 /spec/controllers/general_controller_spec.rb
parent8f8050b8cbf872f3c2d99d8ee1c0b41aec490a59 (diff)
Mock xapian call for specs that are really for orthogonal things like localization.
Diffstat (limited to 'spec/controllers/general_controller_spec.rb')
-rw-r--r--spec/controllers/general_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index f71815746..43d290546 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -37,6 +37,20 @@ describe GeneralController, "when showing the frontpage" do
integrate_views
+ before do
+ public_body = mock_model(PublicBody, :name => "Example Public Body",
+ :url_name => 'example_public_body')
+ info_request = mock_model(InfoRequest, :public_body => public_body,
+ :title => 'Example Request',
+ :url_title => 'example_request')
+ info_request_event = mock_model(InfoRequestEvent, :created_at => Time.now,
+ :info_request => info_request,
+ :described_at => Time.now,
+ :search_text_main => 'example text')
+ xapian_result = mock('xapian result', :results => [{:model => info_request_event}])
+ controller.stub!(:perform_search).and_return(xapian_result)
+ end
+
it "should render the front page successfully" do
get :frontpage
response.should be_success
@@ -124,6 +138,8 @@ describe GeneralController, "when showing the frontpage" do
I18n.available_locales = old_i18n_available_locales
end
end
+end
+describe GeneralController, "when showing the front page with fixture data" do
describe 'when constructing the list of recent requests' do