Sha256: 1bc4e2fdf7236b0d8527ddd63f15c20c4f9b375a8135696c1bd2867a9f0cd5c7

Contents?: true

Size: 1.11 KB

Versions: 20

Compression:

Stored size: 1.11 KB

Contents

$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..'))
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), *%w[.. lib]))

require 'blather'
require 'rubygems'
require 'minitest/spec'
require 'mocha'
require 'mocha/expectation_error'

MiniTest::Unit.autorun

module MiniTest
  require 'pathname' if MINI_DIR =~ %r{^./}

  module Assertions
    def assert_change(stmt, args = {}, msg = nil)
      msg ||= proc {
        m = "Expected #{stmt} to change"
        m << " by #{mu_pp args[:by]}" if args[:by]
        m << (args[:from] ? " from #{mu_pp args[:from]}" : '') + " to #{mu_pp args[:to]}" if args[:to]
        m
      }.call

      init_val = eval(stmt)
      yield
      new_val = eval(stmt)

      assert_equal(args[:by], (new_val - init_val), msg) if args[:by]
      assert_equal([args[:from], args[:to]], [(init_val if args[:from]), new_val], msg) if args[:to]
      refute_equal(init_val, new_val, msg) if args.empty?
    end
  end
end

class Object
  def must_change *args, &block
    return MiniTest::Spec.current.assert_change(*args, &self)
  end
end

def parse_stanza(xml)
  Nokogiri::XML.parse xml
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
sprsquish-blather-0.4.0 spec/spec_helper.rb
sprsquish-blather-0.4.1 spec/spec_helper.rb
sprsquish-blather-0.4.2 spec/spec_helper.rb
sprsquish-blather-0.4.3 spec/spec_helper.rb
sprsquish-blather-0.4.4 spec/spec_helper.rb
blather-0.4.13 spec/spec_helper.rb
blather-0.4.12 spec/spec_helper.rb
blather-0.4.11 spec/spec_helper.rb
blather-0.4.10 spec/spec_helper.rb
shingara-blather-0.4.9 spec/spec_helper.rb
shingara-blather-0.4.8 spec/spec_helper.rb
blather-0.4.8 spec/spec_helper.rb
blather-0.4.7 spec/spec_helper.rb
blather-0.4.6 spec/spec_helper.rb
blather-0.4.5 spec/spec_helper.rb
blather-0.4.4 spec/spec_helper.rb
blather-0.4.3 spec/spec_helper.rb
blather-0.4.2 spec/spec_helper.rb
blather-0.4.1 spec/spec_helper.rb
blather-0.4.0 spec/spec_helper.rb