Sha256: d14bddfbbf74d5b3e6e2ae9ff1320f38f2992ed92da8d7c9abc725ad09449de6

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

require 'rack/test'
require 'rr'

ENV['RACK_ENV'] = 'test'

def stub_module(full_name)
  full_name.to_s.split(/::/).inject(Object) do |context, name|
    begin
      context.const_get(name)
    rescue NameError
      context.const_set(name, Module.new)
    end
  end
end

def stub_class(full_name)
  full_name.to_s.split(/::/).inject(Object) do |context, name|
    begin
      context.const_get(name)
    rescue NameError
      if /#{name}$/ =~ full_name
        context.const_set(name, Class.new)
      else
        context.const_set(name, Module.new)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rod-rest-0.5.2 test/spec/test_helper.rb
rod-rest-0.5.1 test/spec/test_helper.rb
rod-rest-0.5.0 test/spec/test_helper.rb
rod-rest-0.0.1.1 test/spec/test_helper.rb
rod-rest-0.0.1 test/spec/test_helper.rb