Sha256: a867f4ffc50a6d2b9659f42eee9633b563938af3ba484789339c12aa7ef3a6cf
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
= RR RR (Double Ruby) is a double framework that features a rich selection of double techniques and a terse syntax. http://xunitpatterns.com/Test%20Double.html Currently RR implements mocks, stubs, and probes. It is a goal of RR to support a wide range of double techniques and patterns. == Mocking http://xunitpatterns.com/Mock%20Object.html view = controller.template mock(view).render(:partial => "user_info") {"Information"} == Stubbing http://xunitpatterns.com/Test%20Stub.html jane = User.new stub(User).find('42') {jane} mock(jane).valid? {true} == Probing Add verifications that a method was called while actually calling it. The following example verifies render partial will be called and renders the partial. view = controller.template probe(view).render(:partial => "user_info") == Block Syntax script = MyScript.new mock(script) do |m| m.system("cd #{RAILS_ENV}") {true} m.system("rake foo:bar") {true} m.system("rake baz") {true} end == Terse Syntax One of the goals of RR is to make doubles more scannable. This is accomplished by removing words from a double declaration. Here is RR compared to other mock frameworks: flexmock(User).should_receive(:find).with('42').and_return(jane) # Flexmock User.should_receive(:find).with('42').and_return(jane) # Rspec User.expects(:find).with('42').returns {jane} # Mocha mock(User).find('42') {jane} # RR
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rr-0.1.1 | README |
rr-0.1.0 | README |