Mocha Mock Carries To Another Test

后端 未结 5 1040
无人共我
无人共我 2020-12-06 00:50

I have been following the 15 TDD steps to create a Rails application guide - but have run into an issue I cannot seem to resolve. For the functional test of the WordsContro

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 01:32

    Additionally, it seems mocha_teardown is not being called with rails31. Mocks that are setup are never removed... (this additional hack fixes it)

      class ActiveSupport::TestCase
        def teardown
          super
          Mocha::Mockery.instance.teardown
          Mocha::Mockery.reset_instance    
        end
      end
    

提交回复
热议问题