Skip to content

Instantly share code, notes, and snippets.

diff --git a/test/test_helper.rb b/test/test_helper.rb
index 8ca9c51..8e13d5d 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -10,23 +10,28 @@ require 'toto'
module Riot
class Assertion
assertion(:includes) do |actual, expected|
- actual.include?(expected) || fail("expected #{actual} to include #{expected}")
+ actual.include?(expected) ? pass : fail("expected #{actual} to include #{expected}")
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0], MBARI 0x8770, Ruby Enterprise Edition 2009.10
#
# Riot vs Shoulda vs Test::Unit
#
Rehearsal ----------------------------------------------
Riot 0.360000 0.000000 0.360000 ( 0.367155)
Test::Unit 1.250000 0.010000 1.260000 ( 1.259351)
Shoulda 1.290000 0.000000 1.290000 ( 1.315967)
class Foo
##
# I want to document this block because it will end up creating a method
my_class_method(:bar) do |foo|
puts "I'm, doing something"
end
end
def classpath(g)
path = g.runtime_dependencies.inject([]) do |acc, dep|
acc + classpath(Gem.source_index.find_name(dep.name, dep).first)
end
path << g.full_gem_path
end
classpath(Gem.source_index.find_name('radiant').first).join(':')
class A
def initialize
super()
puts "Hairy chins"
end
end
B = Class.new(A)
B.new
#
# magical binding
#
module RiotA
module AssertionMacros
# def equals(expected) puts "yay"; end
def equals(expected) true; end
end
require 'benchmark'
class Foo
def a; true; end
end
n = 1_000_000
Benchmark.bm(30) do | b |
instance = Foo.new
b.report( "a simple method call" ) do
# ...
context "for a given user" do
setup do
topic.user = User.create(:name => "acme", :email => "a@b.com",
:password => "h3ll0", :password_confirmation => "h3ll0")
topic.description = "Foo Bar"
topic.name = "foo_bar"
topic.save!
topic
class FoosController < ActionController::Base
end
context "a controller test" do
controlling :foos
asserts("situation") { self }.respond_to(:get)
asserts("situation") { self }.respond_to(:post)
asserts("situation") { self }.respond_to(:put)
asserts("situation") { self }.respond_to(:delete)