This repository has been archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, `@messages` was not cleared when new instances were created, so the `description`, `failure_message_for_should` and `failure_message_for_should_not` blocks would take on the value set by the most recently built instance. In a case like: RSpec::Matchers.define(:be_like_a) do |expected| description { "be like a #{expected}" } end be_like_a_moose = be_like_a("moose") be_like_a_horse = be_like_a("horse") ...each matcher instance eval'd the `define` block once. Since the object that holds a reference to the description block (the `@messages` instance variable) was not cleared between the two examples, the description block for both instances would have `expected` bound to "horse" (since it was instantiated last, and its define block eval'd last). This caused the description and failure messages to return the wrong values in situations like these.
- Loading branch information
1 parent
569219c
commit fc4b66d
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters