Sha256: 3d9e7586655de8492b0b6a11efddcb9eeeee1f8579a3de5be4bc830737374996
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
SPEC_FOLDER = File.dirname(__FILE__) require 'yogi_berra' require 'rspec/mocks' # Helper methods # Creates RunTimeError 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_client(client_should = false, connection_should = false, auth = true) mongo_client = double('mongo client') mongo_connection = double('mongo connection') Mongo::MongoClient.should_receive(:new) { mongo_client } mongo_client.should_receive(:[]) { mongo_connection } if client_should mongo_connection.should_receive(:authenticate) if auth if connection_should mongo_connection.should_receive(:[]) { mongo_connection } mongo_connection.should_receive(:insert) end mongo_connection end def reset_if_rails if defined?(Rails) Object.send(:remove_const, :Rails) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yogi_berra-0.0.14 | spec/spec_helper.rb |
yogi_berra-0.0.13 | spec/spec_helper.rb |
yogi_berra-0.0.12 | spec/spec_helper.rb |