forked from rspec/rspec-expectations
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8056ead
commit d1cd262
Showing
2 changed files
with
20 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
require 'rspec/expectations/extensions/kernel' | ||
require 'rspec/expectations/extensions/rspec/core/example_group' |
19 changes: 19 additions & 0 deletions
19
lib/rspec/expectations/extensions/rspec/core/example_group.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Rspec | ||
module Core | ||
class ExampleGroup | ||
module BlockAliases | ||
alias_method :to, :should | ||
alias_method :to_not, :should_not | ||
end | ||
|
||
# Extends the submitted block with aliases to and to_not | ||
# for should and should_not. Allows expectations like this: | ||
# | ||
# expect { this_block }.to change{this.expression}.from(old_value).to(new_value) | ||
# expect { this_block }.to raise_error | ||
def expect(&block) | ||
block.extend BlockAliases | ||
end | ||
end | ||
end | ||
end |