Sha256: e9a4025756e18b94f4d1fc63f56e3b4f3836ea06f7bd874808c901554d3b1bd0

Contents?: true

Size: 1.38 KB

Versions: 47

Compression:

Stored size: 1.38 KB

Contents

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

class Issue65Test < Test::Unit::TestCase

  include AcceptanceTest

  def setup
    setup_acceptance_test
  end

  def teardown
    teardown_acceptance_test
  end

  def test_expectations_on_class_methods_on_same_class_should_be_verified_in_consecutive_tests
    klass = Class.new do
      def self.foo; end
      def self.bar; end
    end
    test_1 = run_as_test do
      klass.expects(:foo)
      klass.foo
    end
    assert_passed(test_1)
    test_2 = run_as_test do
      klass.expects(:bar)
    end
    assert_failed(test_2)
  end

  def test_expectations_on_any_instance_methods_on_same_class_should_be_verified_in_consecutive_tests
    klass = Class.new do
      def foo; end
      def bar; end
    end
    test_1 = run_as_test do
      klass.any_instance.expects(:foo)
      klass.new.foo
    end
    assert_passed(test_1)
    test_2 = run_as_test do
      klass.any_instance.expects(:bar)
    end
    assert_failed(test_2)
  end

  def test_expectations_on_instance_methods_on_same_object_should_be_verified_in_consecutive_tests
    instance = Class.new do
      def foo; end
      def bar; end
    end.new
    test_1 = run_as_test do
      instance.expects(:foo)
      instance.foo
    end
    assert_passed(test_1)
    test_2 = run_as_test do
      instance.expects(:bar)
    end
    assert_failed(test_2)
  end
end

Version data entries

47 entries across 39 versions & 4 rubygems

Version Path
mocha-0.11.0 test/acceptance/issue_65_test.rb
challah-0.5.4 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_65_test.rb
challah-0.5.3 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_65_test.rb
challah-0.5.2 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_65_test.rb
challah-0.5.1 vendor/bundle/gems/mocha-0.10.5/test/acceptance/issue_65_test.rb
mocha-0.10.5 test/acceptance/issue_65_test.rb
mocha-0.10.4 test/acceptance/issue_65_test.rb