Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Oct 10, 2009
1 parent e85319b commit a2c02a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
Binary file modified RSpecTipsAndTricks.key
Binary file not shown.
29 changes: 2 additions & 27 deletions code/railsapp/spec/helpers/accounts_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
require 'spec_helper'

module WrappedAssertions
attr_reader :assertion_error

def self.extension_modules
@extension_modules ||= [Test::Unit::Assertions]
end

def self.add_assertions(mod)
extension_modules << mod
end

def wrap_assertion
WrappedAssertions.extension_modules.map {|mod| extend mod}
begin
yield
true
rescue Exception => e
@assertion_error = e
false
end
end
end

WrappedAssertions.add_assertions ActionController::TestCase::Assertions

Spec::Matchers.define :match_dom do |expected|
extend WrappedAssertions
extend ActionController::TestCase::Assertions
match do |actual|
wrap_assertion do
wrapped_assertion do
assert_dom_equal expected, actual
end
end
Expand Down

0 comments on commit a2c02a3

Please sign in to comment.