Sha256: 697e295719dd1b59f487c26316c7e25843ca09665cf34d397ca866a2f4f71295

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'
module Spec
  module Runner
    class SpecMatcherTest < Test::Unit::TestCase
      
      def test_should_match_context_and_spec
        matcher = SpecMatcher.new("a context with a spec", "a context")
        assert matcher.matches?("with a spec")
      end

      def test_should_match_with_regexp_reserved_characters
        matcher = SpecMatcher.new("a context with #[] a spec", "a context")
        assert matcher.matches?("with #[] a spec")
      end
      
      def test_should_not_match_wrong_context
        matcher = SpecMatcher.new("another context with a spec", "a context")
        assert !matcher.matches?("with a spec")
      end
     
      def test_should_not_match_wrong_spec
        matcher = SpecMatcher.new("a context with another spec", "a context")
        assert !matcher.matches?("with a spec")
      end
      
      def test_should_match_context_only
        matcher = SpecMatcher.new("a context", "a context")
        assert matcher.matches?("with a spec")
      end
      
      def test_should_not_match_wrong_context_only
        matcher = SpecMatcher.new("another context", "a context")
        assert !matcher.matches?("with a spec")
      end
      
      def test_should_match_spec_only
        matcher = SpecMatcher.new("with a spec", "a context")
        assert matcher.matches?("with a spec")
      end
      
      def test_should_match_wrong_spec_only
        matcher = SpecMatcher.new("with another spec", "a context")
        assert !matcher.matches?("with a spec")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-0.6.2 test/spec/runner/spec_matcher_test.rb
rspec-0.6.1 test/spec/runner/spec_matcher_test.rb
rspec-0.6.3 test/spec/runner/spec_matcher_test.rb
rspec-0.6.4 test/spec/runner/spec_matcher_test.rb