Skip to content

Instantly share code, notes, and snippets.

View mariovisic's full-sized avatar

Mario Visic mariovisic

View GitHub Profile
@mariovisic
mariovisic / random_ip_address.rb
Created June 5, 2011 14:52
Random IP Addresses
@addresses = []
10000.times do
@addresses.push Faker::Internet::ip_v4_address
end
@addresses == @addresses.uniq # => true
rake db:drop db:create && script/dbconsole < db/dump/postgresql && rake db:migrate
psql imeducate_staging -a -f db/dump/partial_export_old_site.sql -U imeducate -h localhost
require 'spec_helper'
describe AvatarUploader do
let(:avatar_uploader) { AvatarUploader.new(outing, :avatar) }
let(:location) { Factory.build(:location, :id => 123) }
let(:user) { Factory.build(:user, :id => 103) }
let(:outing) { Factory.build(:outing, :id => 101, :image_token => 'image_token') }
# Speeds up testing Carrier Wave by turning off uneccessary processing
if Rails.env.test?
CarrierWave.configure do |config|
config.storage = :file
config.enable_processing = false
config.root = Rails.root.join('spec', 'support', 'uploads')
end
end
require 'factory_girl'
Dir[Rails.root.join("spec/factories/**/*.rb")].each {|f| require f}
seed_file = Rails.root.join('db', 'seed.yml')
objects = YAML::load_file(seed_file)
# Create a member login for development and staging
if Rails.env.development? || Rails.env.staging?
[Address, Member, Admin].each do |model|
name = model.to_s.pluralize.underscore
require 'factory_girl'
Dir[Rails.root.join("spec/factories/**/*.rb")].each {|f| require f}
seed_file = Rails.root.join('db', 'seed.yml')
objects = YAML::load_file(seed_file)
# Create a member login for development and staging
if Rails.env.development? || Rails.env.staging?
[Address, Member, Admin].each do |model|
name = model.to_s.pluralize.underscore
context 'geo finding' do
before :all do
@location_one = Factory.build(:location, :lat => 42.000000, :lng => 0.000000)
@location_two = Factory.create(:location, :lat => 42.000000, :lng => 0.050000) # 4.14km's from location one
@location_three = Factory.create(:location, :lat => 42.000000, :lng => 0.100000) # 8.29km's from location one
end
after :all do
Location.delete_all
TFG-MV-iMac:imeducate mario$ cap production deploy:check
* == Currently executing `production'
* == Currently executing `defaults:check_variables'
* == Currently executing `stages:ensure'
* == Currently executing `deploy:check'
* == Currently executing `defaults:check'
* == Currently executing `defaults:fix_linked_permissions'
* == Currently executing `rvm:check_shell'
* executing "true"
* establishing connection to gateway `"prowl.thefrontiergroup.net.au"'
source 'http://rubygems.org'
gem 'has_face'