Skip to content

Instantly share code, notes, and snippets.

View larrytheliquid's full-sized avatar

Larry Diehl larrytheliquid

View GitHub Profile
module BugWalkSimulation
describe Bug, "#dead?" do
it "should be false when the number of moves is less than the moves lifetime" do
bug = new_bug(:moves_lifetime => 3)
bug.expects(:number_of_moves).returns(2)
bug.should_not be_dead
end
it "should be true when the number of moves is greater than the moves lifetime" do
bug = new_bug(:moves_lifetime => 2)
(ns clojure (:use specjure))
(describe + "without arguments"
(it "returns 0"
(should = 0 (+))))
(describe + "with a single argument"
(it "returns the argument"
(should = 1 (+ 1))
(should = 1337 (+ 1337))))
(ns clojure (:use specjure))
(it + "without arguments returns 0"
(should = (+) 0))
(it + "with a single argument returns the argument"
(should = 1 (+ 1))
(should = 1337 (+ 1337)))
(it + "with multiple arguments returns the sum of the arguments"
;;; RSpec stack example: http://rspec.info/examples.html
;;; Implementation
(ns specjure.examples
(:refer-clojure :exclude [empty? peek])
(:use specjure))
(defn stack []
(ref ()))
(share-test "non-empty specjure.examples/stack" []
(test "is not empty"
(is (not (empty? ($get :stack)))))
(test "returns the top item when applied to specjure.examples/peek"
(is (= ($get :last-item-added) (peek ($get :stack)))))
(test "does not remove the top item when applied to specjure.examples/peek"
(is (= ($get :last-item-added) (peek ($get :stack))))
(is (= ($get :last-item-added) (peek ($get :stack)))))
require "rubygems"
require "rack/client"
require "rack/contrib"
puts "PUT'ing /store/fruit (with strawberry)"
puts
Rack::Client.put "http://localhost:9292/store/fruit", "strawberry"
puts "GET'ing /store/fruit"
# tail.rb
# JAVA_OPTS="-Djruby.tailcall.enabled=true" jruby tail.rb --1.9
# Error: Your application used more stack memory than the safety cap of 1024k.
# Specify -J-Xss####k to increase it (#### = cap size in KB).
# Specify -w for full StackOverflowError stack trace
def fact(n, acc)
if n == 0
acc
else
require 'rubygems'
require 'eventmachine'
require 'em-http'
require 'dataflow'
Thread.new {
EM.run{}
}
module EventMachine
"the /data/nginx/servers/:application.rewrites for the customer's application file exists" =~ /^the ((?:\w+|\/|\.|-|~|:)+(?:for the \S+ application)?) file exists$/
Scenario Outline: filesystem setup
Then the <path> <type> exists
And the owner of <path> is the <user> user
And the group of <path> is the group of the <user> user
And the permissions for <path> are <permissions>
Scenarios: configuration
| type | permissions | user | path |
| file | 0644 | customer's | /data/nginx/nginx.conf |
| directory | 0775 | customer's | /data/nginx/ssl |