Sha256: 10e6f2ee8c3705011293aa0ecd3d1cd9e98a3dd111d1241d73a48ec48010e6f1

Contents?: true

Size: 856 Bytes

Versions: 13

Compression:

Stored size: 856 Bytes

Contents

require File.dirname(__FILE__) + '/../../test_helper'

module Spec
  module Runner
    class ExecutionContextTest < Test::Unit::TestCase

      def test_should_add_new_mock_to_spec_when_mock_message_received
        spec = Api::Mock.new "spec"
        spec.should.receive(:add_mock) {|mock| mock.instance_of? Api::Mock}
        ec = ExecutionContext.new spec
        mock = ec.mock("a mock", :null_object=>true)
      end
      
      def test_violated
        assert_raise(Spec::Api::ExpectationNotMetError) do
          ExecutionContext.new(nil).violated
        end
      end
      
      def test_duck_type
        ec = ExecutionContext.new(Api::Mock.new("spec", :null_object => true))
        duck_type = ec.duck_type(:length)
        assert duck_type.is_a?(Api::DuckTypeArgConstraint)
        assert duck_type.matches?([])
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rspec-0.5.11 test/spec/runner/execution_context_test.rb
rspec-0.5.10 test/spec/runner/execution_context_test.rb
rspec-0.5.12 test/spec/runner/execution_context_test.rb
rspec-0.5.13 test/spec/runner/execution_context_test.rb
rspec-0.5.14 test/spec/runner/execution_context_test.rb
rspec-0.5.16 test/spec/runner/execution_context_test.rb
rspec-0.5.4 test/spec/runner/execution_context_test.rb
rspec-0.5.5 test/spec/runner/execution_context_test.rb
rspec-0.5.7 test/spec/runner/execution_context_test.rb
rspec-0.5.8 test/spec/runner/execution_context_test.rb
rspec-0.5.9 test/spec/runner/execution_context_test.rb
rspec-0.5.15 test/spec/runner/execution_context_test.rb
rspec-0.5.6 test/spec/runner/execution_context_test.rb