Module: SharedShould::SharedContext

Included in:
MiniTest::Unit::TestCase, Shoulda::Context, Shoulda::Context::Context, Test::Unit::TestCase
Defined in:
lib/shared_should/shared_context.rb

Defined Under Namespace

Modules: SharedContextMethods

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object

class methods for Test::Unit::TestCase



3
4
5
6
7
8
9
10
11
12
# File 'lib/shared_should/shared_context.rb', line 3

def self.extended(klass)
  class << klass
    # these methods need to be aliased for both the test class and the should context
    alias_method :context_without_shared_proxies_executing, :context
    alias_method :should_without_param_support, :should
    alias_method :setup_without_param_support, :setup
  end
  
  klass.extend(SharedContextMethods)
end

.included(klass) ⇒ Object

instance methods for Shoulda::Context



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/shared_should/shared_context.rb', line 15

def self.included(klass)
  klass.class_eval do
    # these methods need to be aliased for both the test class and the should context
    alias :context_without_shared_proxies_executing :context
    alias :should_without_param_support :should
    alias :setup_without_param_support :setup
    
    # remove any methods we are going to define with our included module
    SharedContextMethods.instance_methods.each do |method_name|
      remove_method method_name if method_defined? method_name
    end
  end
  
  klass.send(:include, SharedContextMethods)
end