Sha256: c1811ddc837752fdb0611a412c05b70b7029ae6f3d18823358d190903f102df7

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

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)
  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
  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

1 entries across 1 versions & 1 rubygems

Version Path
yogi_berra-0.0.11 spec/spec_helper.rb