Skip to content

Instantly share code, notes, and snippets.

@mlins
Created July 24, 2008 14:55
Show Gist options
  • Save mlins/2165 to your computer and use it in GitHub Desktop.
Save mlins/2165 to your computer and use it in GitHub Desktop.
class Main
def self.run
b = Blah.new
b.start
b.stop
end
end
require 'spec_helper.rb'
require 'main'
describe "main" do
before do
@blah = flexmock(:start => true, :stop => true)
Blah = flexmock(:new => @blah)
end
it "should start blah" do
@blah.should_receive(:start).and_return(true)
Main.run
end
it "should start blah" do
@blah.should_receive(:stop).and_return(true)
Main.run
end
after do
Object.send(:remove_const, :Blah)
end
end
begin
require 'spec'
rescue LoadError
require 'rubygems'
gem 'rspec'
require 'spec'
end
Spec::Runner.configure do |config|
config.mock_with :flexmock
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment