ruby - Not able to call instance_double twice -


i'm writing test fot rspec check items added class use array

    describe '#collection'         let(:process) {             instance_double("webserverprocess", :cpu => 33, :mem => 22, :pid => 1, :port => 8000)         }         'return collection'             webserverscollection.add process             expect(subject.collection).to eq([process])         end         'should add <<'             webserverscollection << process             expect(subject.collection).to eq([process])         end     end 

show me error

failure/error: expect(subject.collection).to eq([process]) # created in 1 example has leaked example , can no longer used. rspec-mocks' doubles designed last 1 example, , need create new 1 in each example wish use for.

i think error tells need know.

you can't and

you need create new 1 in each example wish use for


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -