rspec v1.2에서 any_instance의 별명은 무엇입니까?rspec의 Object.any_instance (v. 1.2)
Object.any_instance.stub(:foo).and_return("return_value")
P.
내 영어로 죄송합니다.
rspec v1.2에서 any_instance의 별명은 무엇입니까?rspec의 Object.any_instance (v. 1.2)
Object.any_instance.stub(:foo).and_return("return_value")
P.
내 영어로 죄송합니다.
"해킹"은 테스트 범위에서 클래스의 메서드를 다시 정의하는 것이 었습니다.
당신이 만들고 싶어 같은 스텁 :
SomeClass.any_instance.stub(:foo).and_return(return_value)
- 유사한 결과가 달성 할 수있는 몇 가지 해킹 또는 아무것도에 대한
describe SomeClass
class SomeClass
def foo
return "return value"
end
end
# your test goes here
end
하나도 존재하지 않습니다. any_instance
은 rspec-2.6에서 처음 지원되었습니다 : http://rubydoc.info/gems/rspec-mocks/file/Changelog.md.
무엇입니까? – ted