Skip to content

Instantly share code, notes, and snippets.

View paul's full-sized avatar

Paul Sadauskas paul

View GitHub Profile
HISTFILE=$HOME/.zsh_history
HISTSIZE=5000
SAVEHIST=10000 # useful for setopt append_history
export EDITOR='vim'
export PAGER='most'
export SHELL='/bin/zsh'
PATH=./bin:$HOME/bin:$PATH:/usr/sbin:/opt/kde/bin:/opt/openoffice/program
BC_ENV_ARGS="-q -l /home/rando/.bc/extensions.bc"
def service_descriptor
resp = http.resource(@service_descriptor_uri, default_headers).get
unless resp.is_not_modified? || (resp.is_success? && !resp.authoritative?)
@service_descriptor = JSON.parse(resp.body)
end
return @service_descriptor
end
diff --git a/merb-auth/merb-auth-core/lib/merb-auth-core/authenticated_helper.rb b/merb-auth/merb-auth-core/lib/merb-auth-core/authenticated_helper.rb
index 24a39d4..b649d94 100644
--- a/merb-auth/merb-auth-core/lib/merb-auth-core/authenticated_helper.rb
+++ b/merb-auth/merb-auth-core/lib/merb-auth-core/authenticated_helper.rb
@@ -31,8 +31,8 @@ module Merb
def ensure_authenticated(*strategies)
session.authenticate!(request, params, *strategies) unless session.authenticated?
auth = session.authentication
+ self.headers.merge!(auth.headers)
if auth.halted?
def self.all(query = {})
if query.has_key?(:visible_to?)
account = query.delete(:visible_to?)
end
set = super
set.select { |o| o.visible_to?(account) }
end
match('/templates').
to(:controller => 'templates', :action => 'index').
name(:templates)
match('/templates/:id', :id => /.+/).
to(:controller => 'templates', :action => 'show').
name(:template)
# TODO Use this instead once carllerche fixes the route generation order
# resources :templates, :id => /.+/ do
# resources :questions, :keys => :name, :name => /.+/
# Request specs in rails
def perform(method, path, params, headers)
#why the hell is Integration::Session#process a private method?
self.send(method, path, params, headers)
end
# Use it like:
perform(:get, '/', {}, {})
describe 'POST SSKJ1 to /privileges', :type => 'service' do
extend ServiceHelpers::Group
include ServiceHelpers::Example
def post_privilege(pairs = {})
post_sskj1(privileges_url, privilege_sskj1_json(pairs))
end
request do |attributes|
describe 'POST SSKJ1 to /privileges', :type => 'service' do
request { |attributes|
post_sskj1(privileges_url, privilege_sskj1_json(attributes))
}
should_be_created
should_require_pairs :name
should_ignore_pairs :href, :id, :_type
require File.join(File.dirname(__FILE__), 'privilege_shared_specs')
describe 'POST SSKJ1 to /privileges', :type => 'service' do
request { |attributes|
post_sskj1(privileges_url, privilege_sskj1_json(attributes))
}
should_be_created