Created
July 24, 2008 14:55
-
-
Save mlins/2165 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Main | |
def self.run | |
b = Blah.new | |
b.start | |
b.stop | |
end | |
end |
This file contains hidden or 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 '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 |
This file contains hidden or 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
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