Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Convert define_example_method to use define_method

  • Loading branch information...
commit 325fcd9a360b4df3bbe1a22eb0853b51b7926ac0 1 parent ea49eca
@soulcutter soulcutter authored
Showing with 8 additions and 9 deletions.
  1. +8 −9 lib/rspec/core/example_group.rb
View
17 lib/rspec/core/example_group.rb
@@ -58,15 +58,14 @@ def description
# @param [Hash] extra_options
# @param [Block] implementation
def self.define_example_method(name, extra_options={})
- module_eval(<<-END_RUBY, __FILE__, __LINE__)
- def #{name}(desc=nil, *args, &block)
- options = build_metadata_hash_from(args)
- options.update(:pending => RSpec::Core::Pending::NOT_YET_IMPLEMENTED) unless block
- options.update(#{extra_options.inspect})
- examples << RSpec::Core::Example.new(self, desc, options, block)
- examples.last
- end
- END_RUBY
+ define_method(name) do |*args, &block|
+ desc = args.shift
+ options = build_metadata_hash_from(args)
+ options.update(:pending => RSpec::Core::Pending::NOT_YET_IMPLEMENTED) unless block
+ options.update(extra_options)
+ examples << RSpec::Core::Example.new(self, desc, options, block)
+ examples.last
+ end
end
# Defines an example within a group.
Please sign in to comment.
Something went wrong with that request. Please try again.