Fix using execution context methods in nested DSL matchers #128

Merged
merged 3 commits into from Apr 1, 2012

Conversation

Projects
None yet
2 participants
lib/rspec/matchers/dsl.rb
@@ -6,8 +6,7 @@ module DSL
def define(name, &declarations)
matcher = RSpec::Matchers::DSL::Matcher.new(name, &declarations)
define_method name do |*expected|
- $matcher_execution_context = self
- matcher.for_expected(*expected)
+ matcher.for_expected(*expected).tap { |m| m.matcher_execution_context = @matcher_execution_context || self }
@justinko

justinko Mar 31, 2012

Contributor

Awesome pull! Unfortunately, we're not dropping 1.8.6 support until 3.0, so if you remove the tap here I'll merge.

justinko added a commit that referenced this pull request Apr 1, 2012

Merge pull request #128 from mirasrael/master
Fix using execution context methods in nested DSL matchers

@justinko justinko merged commit 5ffc547 into rspec:master Apr 1, 2012

Contributor

justinko commented Apr 1, 2012

Thanks!

dchelimsky added a commit that referenced this pull request Apr 2, 2012

Changelog for #128
[ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment