Skip to content
Extraits de code Groupes Projets
Valider 0ff541ba rédigé par maxwell's avatar maxwell
Parcourir les fichiers

fixed the dumb autotest bug. by adding mocha, it seemed to work. also fixed a...

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
parent 29c6f9fa
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -19,6 +19,7 @@ gem "devise", :git => "git://github.com/plataformatec/devise.git" ...@@ -19,6 +19,7 @@ gem "devise", :git => "git://github.com/plataformatec/devise.git"
gem 'ruby-debug' gem 'ruby-debug'
group :test do group :test do
gem 'rspec', '>= 2.0.0.beta.10'
gem 'rspec-rails', ">= 2.0.0.beta.8" gem 'rspec-rails', ">= 2.0.0.beta.8"
gem "mocha" gem "mocha"
gem 'webrat' gem 'webrat'
......
- title "New Status Message" - title "New Status Message"
- form_for @status_message do |f| = form_for @status_message do |f|
= f.error_messages = f.error_messages
%p %p
= f.label :message = f.label :message
......
...@@ -11,23 +11,28 @@ describe StatusMessagesController do ...@@ -11,23 +11,28 @@ describe StatusMessagesController do
render_views render_views
it "index action should render index template" do it "index action should render index template" do
request.env['warden'].should_receive(:authenticate?).at_least(:once)
get :index get :index
response.should render_template(:index) response.should render_template(:index)
end end
it "create action should render new template when model is invalid" do 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) StatusMessage.any_instance.stubs(:valid?).returns(false)
post :create post :create
response.should render_template(:new) response.should render_template(:new)
end 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) StatusMessage.any_instance.stubs(:valid?).returns(true)
post :create post :create
response.should redirect_to(status_message_url(assigns[:status_message])) response.should redirect_to(status_message_url(assigns[:status_message]))
end end
it "new action should render new template" do it "new action should render new template" do
request.env['warden'].should_receive(:authenticate?).at_least(:once)
get :new get :new
response.should render_template(:new) response.should render_template(:new)
end end
...@@ -40,6 +45,8 @@ describe StatusMessagesController do ...@@ -40,6 +45,8 @@ describe StatusMessagesController do
end end
it "show action should render show template" do it "show action should render show template" do
request.env['warden'].should_receive(:authenticate?).at_least(:once)
get :show, :id => StatusMessage.first.id get :show, :id => StatusMessage.first.id
response.should render_template(:show) response.should render_template(:show)
end end
......
...@@ -12,8 +12,8 @@ Rspec.configure do |config| ...@@ -12,8 +12,8 @@ Rspec.configure do |config|
# == Mock Framework # == Mock Framework
# #
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
# #this is a dumb hax TODO
# config.mock_with :mocha config.mock_with :mocha
# config.mock_with :flexmock # config.mock_with :flexmock
# config.mock_with :rr # config.mock_with :rr
config.mock_with :rspec config.mock_with :rspec
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter