Sha256: 77d5ada74363c7843daa39020f1e602ac6e3b622a92da8810cf9b270eb11847c

Contents?: true

Size: 1.33 KB

Versions: 46

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path('../acceptance_test_helper', __FILE__)
require 'mocha'

class Issue70Test < Test::Unit::TestCase

  include AcceptanceTest

  def setup
    setup_acceptance_test
  end

  def teardown
    teardown_acceptance_test
  end

  def test_should_stub_expectations_instance_method
    instance = Class.new do
      def expectations
        :original_return_value
      end
    end.new
    test_result = run_as_test do
      instance.stubs(:expectations).returns(:stubbed_return_value)
      assert_equal :stubbed_return_value, instance.expectations
    end
    assert_passed(test_result)
  end

  def test_should_stub_expectations_class_method
    klass = Class.new do
      def self.expectations
        :original_return_value
      end
    end
    test_result = run_as_test do
      klass.stubs(:expectations).returns(:stubbed_return_value)
      assert_equal :stubbed_return_value, klass.expectations
    end
    assert_passed(test_result)
  end

  def test_should_stub_expectations_any_instance_method
    klass = Class.new do
      def expectations
        :original_return_value
      end
    end
    instance = klass.new
    test_result = run_as_test do
      klass.any_instance.stubs(:expectations).returns(:stubbed_return_value)
      assert_equal :stubbed_return_value, instance.expectations
    end
    assert_passed(test_result)
  end
end

Version data entries

46 entries across 38 versions & 4 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_70_test.rb
mocha-0.12.10 test/acceptance/issue_70_test.rb
challah-0.9.1.beta.3 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_70_test.rb
devise_sociable-0.1.0 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_70_test.rb
mocha-0.12.9 test/acceptance/issue_70_test.rb
mocha-0.12.8 test/acceptance/issue_70_test.rb
challah-0.9.1.beta vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_70_test.rb
challah-0.9.0 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_70_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/mocha-0.12.3/test/acceptance/issue_70_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.3/test/acceptance/issue_70_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.2/test/acceptance/issue_70_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/mocha-0.12.2/test/acceptance/issue_70_test.rb
challah-0.8.3 vendor/bundle/gems/mocha-0.12.3/test/acceptance/issue_70_test.rb
mocha-0.12.7 test/acceptance/issue_70_test.rb
mocha-0.12.6 test/acceptance/issue_70_test.rb
mocha-0.12.5 test/acceptance/issue_70_test.rb
challah-0.8.1 vendor/bundle/gems/mocha-0.12.3/test/acceptance/issue_70_test.rb
mocha-0.12.4 test/acceptance/issue_70_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/mocha-0.12.2/test/acceptance/issue_70_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/mocha-0.12.2/test/acceptance/issue_70_test.rb