Skip to content

Commit

Permalink
Adds workaround for RSpec::Given issue
Browse files Browse the repository at this point in the history
  • Loading branch information
benizi committed Jun 9, 2014
1 parent 4fe4865 commit 406cbc1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/support/have_failed_matcher.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Check for whether this workaround is necessary
# See: https://github.com/jimweirich/rspec-given/pull/43
if Gem::Version.new(::Given::VERSION) > Gem::Version.new('3.5.4')
raise 'This may no longer be needed'
end

RSpec::Given::HaveFailed::HaveFailedMatcher.class_eval do
def wrapped(given)
given.is_a?(::Given::Failure) ? -> { given.call } : -> { }
end

def matches?(given_proc, negative_expectation = false)
super(wrapped(given_proc), negative_expectation)
end

def does_not_match?(given_proc)
super(wrapped(given_proc))
end
end

1 comment on commit 406cbc1

@searls
Copy link

@searls searls commented on 406cbc1 Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benizi: Just an FYI that I plan on releasing a fix for this at some point today if I can manage. Tracking progress in this PR: jimweirich/rspec-given#46

Please sign in to comment.