From 0ff541ba4325b111f21b7801332a13e18dae97cc Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Mon, 14 Jun 2010 11:05:55 -0700
Subject: [PATCH] fixed the dumb autotest bug. by adding mocha, it seemed to
 work.  also fixed a bug where authenticate is called to warden and a view IZ
 MS

---
 Gemfile                                             | 1 +
 app/views/status_messages/new.html.haml             | 2 +-
 spec/controllers/status_messages_controller_spec.rb | 9 ++++++++-
 spec/spec_helper.rb                                 | 4 ++--
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Gemfile b/Gemfile
index 49bdeb36e7..f03bde9f29 100644
--- a/Gemfile
+++ b/Gemfile
@@ -19,6 +19,7 @@ gem "devise", :git => "git://github.com/plataformatec/devise.git"
 gem 'ruby-debug'
 
 group :test do
+	gem 'rspec', '>= 2.0.0.beta.10'
 	gem 'rspec-rails', ">= 2.0.0.beta.8"
 	gem "mocha"
   gem 'webrat'
diff --git a/app/views/status_messages/new.html.haml b/app/views/status_messages/new.html.haml
index 1736639e79..9f8e9fe2d3 100644
--- a/app/views/status_messages/new.html.haml
+++ b/app/views/status_messages/new.html.haml
@@ -1,6 +1,6 @@
 - title "New Status Message"
 
-- form_for @status_message do |f|
+= form_for @status_message do |f|
   = f.error_messages
   %p
     = f.label :message
diff --git a/spec/controllers/status_messages_controller_spec.rb b/spec/controllers/status_messages_controller_spec.rb
index 00c920a886..126bade2c7 100644
--- a/spec/controllers/status_messages_controller_spec.rb
+++ b/spec/controllers/status_messages_controller_spec.rb
@@ -11,23 +11,28 @@ describe StatusMessagesController do
   render_views
   
   it "index action should render index template" do
+    request.env['warden'].should_receive(:authenticate?).at_least(:once)
     get :index
     response.should render_template(:index)
   end
   
   it "create action should render new template when model is invalid" do
+    request.env['warden'].should_receive(:authenticate?).at_least(:once)
+    
     StatusMessage.any_instance.stubs(:valid?).returns(false)
     post :create
     response.should render_template(:new)
   end
   
-  it "create action should redirect when model is valid" do
+  it "create action should redirect when model is valid" do    
     StatusMessage.any_instance.stubs(:valid?).returns(true)
     post :create
     response.should redirect_to(status_message_url(assigns[:status_message]))
   end
   
   it "new action should render new template" do
+    request.env['warden'].should_receive(:authenticate?).at_least(:once)
+    
     get :new
     response.should render_template(:new)
   end
@@ -40,6 +45,8 @@ describe StatusMessagesController do
   end
   
   it "show action should render show template" do
+    request.env['warden'].should_receive(:authenticate?).at_least(:once)
+    
     get :show, :id => StatusMessage.first.id
     response.should render_template(:show)
   end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c45a3abfd1..ee85a915b3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -12,8 +12,8 @@ Rspec.configure do |config|
   # == Mock Framework
   #
   # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
-  #
-  # config.mock_with :mocha
+  #this is a dumb hax TODO
+   config.mock_with :mocha
   # config.mock_with :flexmock
   # config.mock_with :rr
   config.mock_with :rspec
-- 
GitLab