Skip to content

Instantly share code, notes, and snippets.

View johnmcaliley's full-sized avatar

John McAliley johnmcaliley

View GitHub Profile
@johnmcaliley
johnmcaliley / model.rb
Created June 9, 2011 17:38
Set invitation limit when user accepts invite
def accept_invitation!
if self.invited? && self.valid?
self.invitation_token = nil
self.invitation_limit = self.class.invitation_limit
self.save
end
end
#install from rvm site
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
#add to your bash profile
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
#source your bash profile
source .bash_profile
#make sure its working - you should see output: rvm is a function
@johnmcaliley
johnmcaliley / your.feature
Created May 6, 2011 16:04
example of selenium scenario
@selenium
Scenario: Login with Facebook
Given I am on the "facebook" auth page #sends to facebook authorization url
And I fill in "email" with "[email protected]"
And I fill in "pass" with "mypassword"
And I press "Login"
@johnmcaliley
johnmcaliley / env.rb
Created May 6, 2011 15:36
capybara config for facebook auth testing
Capybara.server_port = 3001
Capybara.app_host = "localhost:3001"
Capybara.server do |app, port|
require 'rack/handler/mongrel'
Rack::Handler::Mongrel.run(app, :Port => port)
end
@johnmcaliley
johnmcaliley / Gemfile
Created May 6, 2011 15:30
mongrel config for dev/test
#... other gems up here
group :development do
gem "mongrel", "1.2.0.pre2"
end
group :test do
gem 'cucumber'
gem 'cucumber-rails'
gem 'capybara'
rails g devise:install
rails g devise User
rails g devise:views
rake db:migrate
@johnmcaliley
johnmcaliley / migration_change_data_type.rb
Created April 11, 2011 15:26
Change the data type for a table column in Rails migration
class ChangeDataTypeForWidgetCount < ActiveRecord::Migration
def self.up
change_table :widgets do |t|
t.change :count, :float
end
end
def self.down
change_table :widgets do |t|
t.change :count, :integer