Skip to content

Instantly share code, notes, and snippets.

@andyl
Created March 21, 2011 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyl/878879 to your computer and use it in GitHub Desktop.
Save andyl/878879 to your computer and use it in GitHub Desktop.
Rspec Stub Test
# test1_spec.rb - run this using "rspec test1_spec.rb"
require 'rspec'
class Test1
def initialize
sayhi
end
def sayhi
puts "HI"
end
end
describe Test1 do
it "should work" do
Test1.stub!(:sayhi).and_return("")
Test1.new.should_not be_nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment