Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (32 sloc) 1.143 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
$:.unshift(File.dirname(__FILE__) + "/../lib/")
require 'rubygems'
require 'bundler/setup'

require 'riot'
Riot.verbose
Riot.pretty_dots if ENV["TM_MODE"]

module Riot
  module AssertionTestContextMacros

    def assertion_test_passes(description, success_message="", &block)
      context(description) do
        setup(&block)
        setup { topic.run(Riot::Situation.new) }
        asserts("pass") { topic.first }.equals(:pass)
        asserts("success message") { topic.last }.equals(success_message)
      end
    end

    def assertion_test_fails(description, failure_message, &block)
      context(description) do
        setup(&block)
        asserts("failure") { topic.run(Riot::Situation.new).first }.equals(:fail)
        asserts("failure message") { topic.run(Riot::Situation.new)[1] }.equals(failure_message)
      end
    end

  end # AssertionTestContextMacros
end # Riot

Riot::Context.instance_eval { include Riot::AssertionTestContextMacros }

class MockReporter < Riot::Reporter
  def pass(description, message); end
  def fail(description, message, line, file); end
  def error(description, e); end
  def results; end
end
Something went wrong with that request. Please try again.