Skip to content

Instantly share code, notes, and snippets.

(print "poop")
context RackApp do
get "/" { response.status }.equals(200)
get "/home" { response.body }.matches(/html/)
end
context RackApp do
get "/" do
asserts("okay") { response.status }.equals(200)
asserts("is html") { response.content_type }.equals("text/html")
end
end
An equals assertion macro
+ asserts pass
That is failing
+ reports failure
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTIxMzUwMjYyNjRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBRVjdGwwMCRCb2R5JFJlbWVtYmVyTWWyrWW8ZG7N5cuVqJmx5SoQDnCvVg==" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
./test/../lib/riot/runnable.rb:37:in `run': undefined local variable or method `block' for #<Riot::Assertion:0x2c7f7c0> (NameError)
from ./test/../lib/riot/context.rb:28:in `run'
from ./test/../lib/riot/context.rb:27:in `each'
from ./test/../lib/riot/context.rb:27:in `run'
from ./test/../lib/riot/context.rb:30:in `run'
from ./test/../lib/riot/context.rb:30:in `each'
from ./test/../lib/riot/context.rb:30:in `run'
from ./test/../lib/riot.rb:17:in `run'
from ./test/../lib/riot.rb:17:in `each'
from ./test/../lib/riot.rb:17:in `run'
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': ./test/../lib/riot/runnable.rb:35: syntax error, unexpected ',', expecting '|' (SyntaxError)
define_method(name) do |*expectings, &expectation_block|
^
./test/../lib/riot/runnable.rb:51: syntax error, unexpected kEND, expecting $end
end # Riot
^
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./test/../lib/riot.rb:4
from ./test/teststrap.rb:2:in `require'
from ./test/teststrap.rb:2
class Assertion < RunnableBlock
def self.pass() [:pass]; end
def self.fail(message) [:fail, message]; end
def self.error(e) [:error, e]; end
def run(situation)
#apply expectation block
@expectings << situation.evaluate(&@expectation_block) if @expectation_block
action = @@assertions[@action]
process_macro(situation,action[0]) { |actual| action[1].call(actual,*@expectings) }
end
require 'rubygems'
require 'riot'
module Bang
def go
"yes"
end
end
class Boom
class Person
def say
"hi"
end
def jump
"i jumped"
end
def dance