Sha256: 99c2daa7f828bc7dc3e69322e0be3a9ad2b6b83bb6e8821c6cb0ab984b5ca2ac

Contents?: true

Size: 1.2 KB

Versions: 58

Compression:

Stored size: 1.2 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 MockFrameworkAdapter
      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

Version data entries

58 entries across 58 versions & 15 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
opal-rspec-cj-0.4.4 vendor_lib/rspec/core/mocking/with_mocha.rb
opal-rspec-0.4.3 vendor_lib/rspec/core/mocking/with_mocha.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-core-2.14.8/lib/rspec/core/mocking/with_mocha.rb
opal-rspec-0.4.2 vendor_lib/rspec/core/mocking/with_mocha.rb
opal-rspec-0.4.1 vendor_lib/rspec/core/mocking/with_mocha.rb
opal-rspec-0.4.0 vendor_lib/rspec/core/mocking/with_mocha.rb
opal-rspec-0.4.0.beta4 vendor_lib/rspec/core/mocking/with_mocha.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-core-2.13.0/lib/rspec/core/mocking/with_mocha.rb
rspec-core-2.99.2 lib/rspec/core/mocking/with_mocha.rb
dxruby_rp5-0.0.4 spec/vendor/rspec-core-2.14.7/lib/rspec/core/mocking/with_mocha.rb
rspec-core-2.99.1 lib/rspec/core/mocking/with_mocha.rb
rspec-core-2.99.0 lib/rspec/core/mocking/with_mocha.rb