Sha256: 015bc664b0a652fac0104f7434750329c730eb14f47c86e92320d97dd0bf0527

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

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

module Spec
  module Runner
    class ContextMatchingTest < Test::Unit::TestCase
      
      def setup
        @formatter = Api::Mock.new "formatter"
        @context = Context.new("context") {}
        @matcher = Spec::Api::Mock.new("matcher")
      end
      
      def test_should_use_spec_matcher
        @matcher.should_receive(:matches?).with("submitted spec")
        @context.specify("submitted spec") {}
        assert !@context.matches?("context with spec", @matcher)
      end

      def test_should_only_run_specified_specs_when_specified
        @context.specify("spec1") {}
        @context.specify("spec2") {}
        @context.run_single_spec "context spec1"
        assert_equal 1, @context.number_of_specs
      end
      
      def test_run_all_specs_when_spec_is_not_specified
        @context.specify("spec1") {}
        @context.specify("spec2") {}
        @context.run_single_spec "context"
        assert_equal 2, @context.number_of_specs
      end
      
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-0.5.13 test/spec/runner/context_matching_test.rb
rspec-0.5.14 test/spec/runner/context_matching_test.rb
rspec-0.5.15 test/spec/runner/context_matching_test.rb
rspec-0.5.16 test/spec/runner/context_matching_test.rb
rspec-0.6.0 test/spec/runner/context_matching_test.rb
rspec-0.6.1 test/spec/runner/context_matching_test.rb
rspec-0.6.2 test/spec/runner/context_matching_test.rb
rspec-0.6.3 test/spec/runner/context_matching_test.rb