Sha256: ce72f5807d68c2532d29894167bf5d9cc634c763a622dca4b34a4d1dd869ddf3
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
SPEC_FOLDER = File.dirname(__FILE__) require 'yogi_berra' require 'rspec/mocks' def build_exception raise Exception rescue Exception => caught_exception caught_exception end def build_session { "access" => { "user_id" => 30785, "id" => 605, "password" => "[FILTERED]", "auth_key" => "Baseball is ninety percent mental and the other half is physical." } } end def mock_mongo(opts) mongo_client = double('mongo client') mongo_connection = double('mongo connection') if opts[:mongo_client_stub] Mongo::MongoClient.should_receive(:new) { mongo_client } mongo_client.should_receive(:[]) { mongo_connection } end if opts[:authenticate_stub] == :error mongo_connection.should_receive(:authenticate).and_raise else mongo_connection.should_receive(:authenticate) end if opts[:connection_stub] mongo_connection.should_receive(:[]) { mongo_connection } mongo_connection.should_receive(:insert) end end def mock_yogi_fork_database client = YogiBerra::Catcher.fork_database.join YogiBerra::Catcher.should_receive(:fork_database) { client } end def reset_if_rails if defined?(Rails) Object.send(:remove_const, :Rails) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yogi_berra-0.1.1 | spec/spec_helper.rb |
yogi_berra-0.1.0 | spec/spec_helper.rb |