diff --git a/Gemfile b/Gemfile index 49bdeb36e..f03bde9f2 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 1736639e7..9f8e9fe2d 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 00c920a88..126bade2c 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 c45a3abfd..ee85a915b 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