Skip to content

Commit

Permalink
Implemented Module#module_exec for ruby 1.8.6. This is needed for the…
Browse files Browse the repository at this point in the history
… shared example group parameter feature to work.

This is based on the implementations in rubinius and backports:
- http://github.com/marcandre/backports/blob/v1.18.1/lib/backports/1.8.7/module.rb
- http://github.com/evanphx/rubinius/blob/release-1.0.1/kernel/common/module.rb#L438-441
  • Loading branch information
myronmarston committed Aug 2, 2010
1 parent bf115b7 commit 364f20e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rspec/core.rb
@@ -1,5 +1,6 @@
require 'rspec/core/kernel_extensions'
require 'rspec/core/object_extensions'
require 'rspec/core/module_extensions'
require 'rspec/core/load_path'
require 'rspec/core/deprecation'
require 'rspec/core/reporter'
Expand Down
16 changes: 16 additions & 0 deletions lib/rspec/core/module_extensions.rb
@@ -0,0 +1,16 @@
module RSpec
module Core
module ModuleExtensions
unless respond_to?(:module_exec)
def module_exec(*args, &prc)
instance_exec(*args, &prc)
end
alias_method :class_exec, :module_exec
end
end
end
end

class Module
include RSpec::Core::ModuleExtensions
end

0 comments on commit 364f20e

Please sign in to comment.