Closed vivit-jc closed 10 years ago
You haven't provided enough information to reproduce this, expect(response).to eq(404)
should fail almost immediately, if it's not it's possibly because response is taking a very long time to return, but without further information I can't replicate this, can you produce a standalone reproduction of this?
I'm sorry my inspection was not enough. I created a new rails project, generate a scaffold model and add just only gem 'rspec-rails'
in Gemfile for replication. My test returned a result rightly, expect(response).to eq(404)
was failed. Probably, some gem in my project cause that issue. I'm investigating what gem do it. This is my Gemfile:
source 'https://rubygems.org'
gem 'rails'
gem 'sqlite3'
gem 'execjs'
gem 'therubyracer'
gem "less-rails"
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier', '>= 1.0.3'
end
gem "slim"
gem "ruby_parser"
gem "html2haml"
gem "slim-rails"
gem 'protected_attributes'
gem 'jquery-rails'
gem 'devise'
gem 'kaminari'
gem 'twitter-bootstrap-rails'
gem 'google-analytics-rails'
group :development,:test do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'guard'
end
group :test do
gem 'faker'
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
gem 'selenium-webdriver'
end
group :production do
gem 'mysql2'
end
Any idea?
This is due to a bug in either rack (see rack/rack#419) or rails (see rails/rails#13921 and rails/rails#13982) that causes [response].flatten
to recurse infinitely. Both have been fixed (although I'm not sure if the rails fix has been released) but if you upgrade to versions that have fixes the problem will go away. In the meantime, make expectations about attributes of the response rather than on the response itself.
For more history/discussion see:
I found the case what never ends in controller specs. I should write test code like this:
But I wrote this in mistake:
and I ran rspec test, so it never ends. I'm using latest version of Rails and RSpec. What do you think about?