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 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) |
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
(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)))) |
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
(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" |
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
;;; RSpec stack example: http://rspec.info/examples.html | |
;;; Implementation | |
(ns specjure.examples | |
(:refer-clojure :exclude [empty? peek]) | |
(:use specjure)) | |
(defn stack [] | |
(ref ())) | |
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
(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))))) |
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 "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" |
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
# 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 |
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 'rubygems' | |
require 'eventmachine' | |
require 'em-http' | |
require 'dataflow' | |
Thread.new { | |
EM.run{} | |
} | |
module EventMachine |
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
"the /data/nginx/servers/:application.rewrites for the customer's application file exists" =~ /^the ((?:\w+|\/|\.|-|~|:)+(?:for the \S+ application)?) file exists$/ |
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
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 | |
OlderNewer