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
it "should support one API key" do | |
key = stub_model(ApiKey, :valid? => true) | |
p = Provider.new(@valid_attributes) | |
p.api_keys << key | |
p.api_keys.should have(1).items # <= don't forget to add .items!! | |
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
# | |
# Author:: Adam Jacob (<[email protected]>) | |
# Copyright:: Copyright (c) 2008 HJK Solutions, LLC | |
# License:: GNU General Public License version 2 or later | |
# | |
# This program and entire repository is free software; you can | |
# redistribute it and/or modify it under the terms of the GNU | |
# General Public License as published by the Free Software | |
# Foundation; either version 2 of the License, or any later version. | |
# |
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
w = Webench.new "localhost", 3000 | |
# authenticate / create session | |
w.init_steps << Webench::Step.new do |http, cookie| | |
http.post('/account/login', 'login=username&password=password') | |
end | |
# main test steps | |
w.steps << Webench::Step.new do |http, cookie| | |
http.get('/articles/1',{'COOKIE' => cookie}) |
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
# Taken from RESTful authentication cucumber features | |
Scenario: Anonymous user can not create an account with bad email | |
Given an anonymous user | |
And no user with login: 'Oona' exists | |
When she registers an account with login: 'oona', password: 'monkey', password_confirmation: 'monkey' and email: '' | |
Then she should be at the 'users/new' page | |
And she should see an errorExplanation message 'Email can't be blank' | |
And no user with login: 'oona' should exist | |
When she registers an account with login: 'oona', password: 'monkey', password_confirmation: 'monkey' and email: '[email protected]' | |
Then she should be redirected to the home page |
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
[apearson@aipnode ~]$ sudo chef-client | |
/usr/lib/ruby/1.8/net/http.rb:2097:in `error!': 400 "Bad Request" (Net::HTTPServerException) | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/rest.rb:227:in `run_request' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/rest.rb:90:in `post_rest' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/client.rb:205:in `authenticate' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/client.rb:70:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/bin/chef-client:125 | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/bin/chef-client:119:in `loop' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/bin/chef-client:119 | |
from /usr/bin/chef-client:19:in `load' |
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 'mq' | |
Signal.trap('INT') { AMQP.stop{ EM.stop } } | |
Signal.trap('TERM'){ AMQP.stop{ EM.stop } } | |
AMQP.start(:host => 'aiprabbitmq.amer.gettywan.com') do | |
queue = MQ.queue('foobar') | |
queue.pop{ |msg| | |
unless msg | |
# queue was empty | |
p [Time.now, :queue_empty!] | |
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
[aip@aipnode ~]$ sudo chef-client | |
/srv/chef/cache/cookbooks/openldap/attributes/openldap.rb:21:in `from_file': private method `split' called for nil:NilClass (NoMethodError) | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/cookbook.rb:73:in `load_attributes' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/cookbook.rb:71:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/cookbook.rb:71:in `load_attributes' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/compile.rb:61:in `load_attributes' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/cookbook_loader.rb:107:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/cookbook_loader.rb:106:in `each_value' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/cookbook_loader.rb:106:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.6.2/lib/chef/compile.rb:60:in `load_attributes' |
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
service "apache2" do | |
service_name "httpd" | |
action :enable | |
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
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
PS1="$RED\$(date +%H:%M) \w$GREEN\${RAILS_ENV:+ ($RAILS_ENV)}$YELLOW \$(parse_git_branch) " |
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 'webrat' | |
Webrat.configure do |config| | |
config.mode = :sinatra | |
end | |
class WebratTester | |
include Webrat::Methods | |
include Webrat::Matchers | |
def test_it | |
visit "http://www.google.com" |
OlderNewer