Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
better name for the module
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Apr 22, 2009
1 parent 4107079 commit 994cef2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/spec/example/example_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,18 @@ def execute(run_options, instance_variables) # :nodoc:
success = execution_error.nil? || ExamplePendingError === execution_error
end

module Aliases
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 Aliases
block.extend BlockAliases
end

def eval_each_fail_fast(blocks) # :nodoc:
Expand Down

0 comments on commit 994cef2

Please sign in to comment.