test/helper.rb in sinatra_more-0.1.5 vs test/helper.rb in sinatra_more-0.1.6
- old
+ new
@@ -17,14 +17,23 @@
include Webrat::Matchers
Webrat.configure do |config|
config.mode = :rack
end
-
+
def stop_time_for_test
time = Time.now
Time.stubs(:now).returns(time)
return time
+ end
+
+ # assert_has_tag(:h1, :content => "yellow") { "<h1>yellow</h1>" }
+ # In this case, block is the html to evaluate
+ def assert_has_tag(name, attributes = {}, &block)
+ html = block && block.call
+ matcher = HaveSelector.new(name, attributes)
+ raise "Please specify a block!" if html.blank?
+ assert matcher.matches?(html), matcher.failure_message
end
end
module Webrat
module Logging