Skip to content

Instantly share code, notes, and snippets.

View larrytheliquid's full-sized avatar

Larry Diehl larrytheliquid

View GitHub Profile
;;; RSpec stack example: http://rspec.info/examples.html
;;; Implementation
(ns specjure.examples
(:refer-clojure :exclude [empty? peek])
(:use specjure))
(defn stack []
(ref ()))
(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"
(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))))
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)