-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
We ran into a bug today which pushed our CPU up to 100% and forced us to restart our Mac.
Our test case was something like:
it "returns all the info for a User in JSON excluding password" do
user = FactoryGirl.create(:user)
get :show, :id => user.id
response.should == user.as_json(except: :password_digest)
end
This is a mistake…we intended to test response.body
, not response
. However running this code made the machine completely unresponsive, with the CPU up at 100%.
When we investigated this further (on multiple macs), it seems like comparing a response with any Ruby primitive seems to freeze the test and push the CPU up to 100%.
response.should == {} # 100% CPU
response.should == [] # 100% CPU
ActiveController::TestResponse.new.should == {} # 100% CPU
ActiveController::TestResponse.new.should == ".." # 100% CPU
ActionDispatch::TestResponse.new.should == {} # 100% CPU
request.should == {} # Test runs fine
response.body.should == {} # Test runs fine
Is this an RSpec bug?
Best,
@timothyandrew & @Who828
Metadata
Metadata
Assignees
Labels
No labels