This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe BabysittersController do | |
integrate_views | |
context "when not authenticated" do | |
RestfulActions.for(BabysittersController) do |action| | |
it "should redirect to root path when accessing ##{action.name}" do | |
send action.method, action.name, action.args | |
response.should redirect_to(root_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When deploying for the first time, use vlad:install before vlad:deploy | |
# 1) vlad:install will copy all files matching .sample* in deploy_to/shared/config | |
# 2) edit those files and rename them to their final name | |
# 3) each time you deploy with vlad:deploy, your config files will be symlinked in your application config folder | |
namespace :vlad do | |
def shared_config_path | |
shared_path + '/' + 'config' | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rake::Task.define_task(:environment) | |
load RAILS_ROOT + '/lib/tasks/seed.rake' | |
Rake.application['db:seed:load'].invoke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Keywordable | |
module ClassMethods | |
def keyword(symbol, proc) | |
write_inheritable_attribute :keywords, {} unless read_inheritable_attribute :keywords | |
read_inheritable_attribute(:keywords)[symbol] = proc | |
end | |
end | |
module InstanceMethods | |
def keywords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Autocomplete handler for all core controllers. | |
#---------------------------------------------------------------------------- | |
def auto_complete | |
@query = params[:auto_complete_query] | |
@auto_complete = hook(:auto_complete, self, :query => @query, :user => @current_user) | |
if @auto_complete.empty? | |
@auto_complete = self.controller_name.classify.constantize.my(:user => @current_user, :limit => 10).search(@query) | |
else | |
@auto_complete = @auto_complete.last | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe Snapshot do | |
before(:each) do | |
@observer = PretendObserver.new(@string_io = StringIO.new("","w")) | |
end | |
it "should create a snapshot ready to be applied" do | |
Snapshot.new(:size => "4G", :path => '/dev/vg00/pwet-disk', :name => 'pwet') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usine := Object clone do ( | |
DummyObject := Object clone do ( | |
Suite := Object clone do ( | |
variantName := nil | |
bodyBlock := nil | |
eval := method(x, | |
context := Object clone | |
context setSlot(variantName, x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
u := Usine clone | |
u declare("user", user, | |
user firstname := "John" | |
user lastname := "Connor" | |
user age := suite(a, a+2) | |
) | |
a := u create("user") | |
b := u create("user") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usine := Object clone do ( | |
/* (...) */ | |
create := method (factory, | |
dummy := factories getSlot(factory) clone | |
parentProto := dummy protos first | |
parentProto slotNames foreach(slotName, | |
value := nil | |
if(parentProto getSlot(slotName) type == "Suite", | |
if(suites getSlot(slotName), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define(:user) do |u| | |
u.firstname "John" | |
u.lastname "Connor" | |
u.sequence(:age) { |i| i ] | |
end |