Created
February 18, 2015 05:41
-
-
Save lachie/92e4ef09d32ef0d2cfe3 to your computer and use it in GitHub Desktop.
Hm, I thought this would work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rspec', '~> 3.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> bundle install | |
> bundle exec rspec spec.rb | |
doing the thing thing | |
F | |
Failures: | |
1) Hello does the verification | |
Failure/Error: expect(hello).to receive(:do_the_thing).with('thing') | |
(Double "Hello").do_the_thing("thing") | |
expected: 1 time with arguments: ("thing") | |
received: 0 times | |
# ./spec.rb:17:in `block (2 levels) in <top (required)>' | |
Finished in 0.00385 seconds (files took 0.05977 seconds to load) | |
1 example, 1 failure | |
Failed examples: | |
rspec ./spec.rb:15 # Hello does the verification |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler/setup' | |
require 'rspec' | |
require 'rspec/mocks' | |
module Hello | |
extend self | |
def do_the_thing(arg1) | |
puts "doing the thing #{arg1}" | |
end | |
end | |
describe 'Hello' do | |
it "does the verification" do | |
hello = class_double('Hello') | |
expect(hello).to receive(:do_the_thing).with('thing') | |
Hello.do_the_thing('thing') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment