To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorstandalone
require "rspec/mocks/standalone" to expose the mock framework
outside the RSpec environment. This is especially useful for
exploring rspec-mocks in irb.
- Scenarios
-
- method stub outside rspec
-
- Given
-
a file named "example.rb" with:
require "rspec/mocks/standalone" greeter = double("greeter") greeter.stub(:say_hi) { "Hello!" } puts greeter.say_hi
- When
- I run "ruby example.rb"
- Then
- the output should contain "Hello!"
- message expectation outside rspec
-
- Given
-
a file named "example.rb" with:
require "rspec/mocks/standalone" greeter = double("greeter") greeter.should_receive(:say_hi) RSpec::Mocks.verify
- When
- I run "ruby example.rb"
- Then
- the output should contain "say_hi(any args) (RSpec::Mocks::MockExpectationError)"
- Then
- the output should contain "expected: 1 time"
- Then
- the output should contain "received: 0 times"
Last published over 7 years ago by .