Sha256: 09f2dcb3592dc05144af9ed08e7e9d4dc9de0a803eddb273209805b4306977cd

Contents?: true

Size: 1.29 KB

Versions: 34

Compression:

Stored size: 1.29 KB

Contents

# In order to support all versions of mocha, we have to jump through some
# hoops here.
#
# mocha >= '0.13.0':
#   require 'mocha/api' is required
#   require 'mocha/object' raises a LoadError b/c the file no longer exists
# mocha < '0.13.0', >= '0.9.7'
#   require 'mocha/api' is required
#   require 'mocha/object' is required
# mocha < '0.9.7':
#   require 'mocha/api' raises a LoadError b/c the file does not yet exist
#   require 'mocha/standalone' is required
#   require 'mocha/object' is required
begin
  require 'mocha/api'

  begin
    require 'mocha/object'
  rescue LoadError
    # Mocha >= 0.13.0 no longer contains this file nor needs it to be loaded
  end
rescue LoadError
  require 'mocha/standalone'
  require 'mocha/object'
end

module RSpec
  module Core
    module MockingAdapters
      # @private
      module Mocha
        def self.framework_name
          :mocha
        end

        # Mocha::Standalone was deprecated as of Mocha 0.9.7.
        begin
          include ::Mocha::API
        rescue NameError
          include ::Mocha::Standalone
        end

        def setup_mocks_for_rspec
          mocha_setup
        end

        def verify_mocks_for_rspec
          mocha_verify
        end

        def teardown_mocks_for_rspec
          mocha_teardown
        end
      end
    end
  end
end

Version data entries

34 entries across 31 versions & 8 rubygems

Version Path
opal-rspec-0.8.0 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.8.0.alpha3 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.8.0.alpha2 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.8.0.alpha1 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.7.1 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.7.0 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.6.2 rspec-core/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.7.0.rc.2 rspec-core/upstream/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.6.1 rspec-core/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.6.0 rspec-core/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.6.0.beta1 rspec-core/lib/rspec/core/mocking_adapters/mocha.rb
opal-connect-rspec-0.5.0 rspec-core/lib/rspec/core/mocking_adapters/mocha.rb
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/rspec-core-3.1.7/lib/rspec/core/mocking_adapters/mocha.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/rspec-core-3.1.1/lib/rspec/core/mocking_adapters/mocha.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/rspec-core-3.1.1/lib/rspec/core/mocking_adapters/mocha.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/rspec-core-3.1.1/lib/rspec/core/mocking_adapters/mocha.rb
opal-rspec-0.5.0 rspec-core/lib/rspec/core/mocking_adapters/mocha.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/rspec-core-3.1.7/lib/rspec/core/mocking_adapters/mocha.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-codec-json-2.0.3/vendor/gems/rspec-core-3.1.7/lib/rspec/core/mocking_adapters/mocha.rb
logstash-codec-json-2.0.3 vendor/gems/rspec-core-3.1.7/lib/rspec/core/mocking_adapters/mocha.rb