简体   繁体   English

__persistence__ NoMethodError

[英]__persistence__ NoMethodError

I'm mocking a java interface in rspec 我在rspec中模拟了Java接口

clock = ClockInterface.new
clock.should_receive(:currentTime)

When I run rspec everything works fine but I see a warning which directs me to the following 当我运行rspec时,一切正常,但是我看到一条警告,将我引导至以下位置

https://github.com/jruby/jruby/wiki/Persistence https://github.com/jruby/jruby/wiki/Persistence

When I attempt to set 当我尝试设定

ClockInterface.__persistence__ = true

I get a NoMethodError. 我收到一个NoMethodError。 I'm using jruby 1.7.4 我正在使用jruby 1.7.4

ClockInterface is an interface rather than a class, and doesn't have the __persistent__ method, unlike classes for which that method gets added through their proxy. ClockInterface是接口而不是类,并且不具有__persistent__方法,这不同于通过代理为其添加该方法的类。

To get your test to work properly, you should instead use: 为了使测试正常工作,您应该使用:

clock = mock(ClockInterface)
clock.should_receive(:currentTime)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jruby持续性问题 - Jruby persistence problem NoMethodError:在tomcat上部署rails app时的relative_url_root - NoMethodError: relative_url_root when deploying rails app on tomcat jRuby-1.6.5:NoMethodError未定义方法'[]'用于nil:NilClass - jRuby-1.6.5: NoMethodError undefined method '[]' for nil:NilClass NoMethodError:尝试运行rspec时未定义的方法“ active_record” - NoMethodError: undefined method `active_record' when trying to run rspec 将jdbc sqlserver适配器与jRuby on Rails一起使用时出现NoMethodError - Getting NoMethodError when using jdbc sqlserver adapter with jRuby on Rails 使用sinatra-synchrony在jruby上运行sinatra时出现NoMethodError - NoMethodError when running sinatra on jruby with sinatra-synchrony JRuby:使用StringScanner:NoMethodError:未定义的方法'bol?' 对于nil:NilClass - JRuby : using StringScanner : NoMethodError: undefined method `bol?' for nil:NilClass DateTime.iso8601('2014-07-08T17:51:36.000Z')导致NoMethodError吗? - DateTime.iso8601('2014-07-08T17:51:36.000Z') results in NoMethodError? NoMethodError:在Ruby中运行测试套件时,“ unit / TestTestName.rb”的未定义方法“运行” - NoMethodError: undefined method `run' for “unit/TestTestName.rb” when running testsuite in ruby 为什么'gem install bundler'为nil:NilClass抛出“ NoMethodError未定义的方法'size'”? - Why does 'gem install bundler' throw “NoMethodError undefined method `size' for nil:NilClass”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM