Sha256: ee539dd11d10ffca5c4309b148815de938fe392f25b9696b32fa96b41f3a581a

Contents?: true

Size: 1.87 KB

Versions: 6

Compression:

Stored size: 1.87 KB

Contents

require File.dirname(__FILE__) + "/../../../spec_helper"

module Spec
  module Example
    describe ExampleMethods do
      it_should_behave_like "sandboxed rspec_options"

      it "should have identifier that can locate the example by line" do
        group = describe("test") do
          it("example") {}
          it("example") {}
        end

        example_1 = group.examples.first
        example_2 = group.examples.last

        example_1.identifier.locate([group]).should == example_1
        example_2.identifier.locate([group]).should == example_2
      end

      it "should have identifier that can locate the example by name" do
        group = describe("test") do
          2.times do |i|
            it("example#{i}") {}
          end
        end

        example_1 = group.examples.first
        example_2 = group.examples.last

        example_1.identifier.locate([group]).should == example_1
        example_2.identifier.locate([group]).should == example_2
      end

      describe ExampleMethods::Identifier do
        it "should use descriptions in to_s" do
          group = describe("test") do
            it("example") {}
          end

          group.examples.first.identifier.to_s.should == "test example"
        end

        it "should be equal if basenames of paths are equal" do
          id1 = ExampleMethods::Identifier.new("/a/spec.rb",
                                               10,
                                               "group description",
                                               "description")
                                               
          id2 = ExampleMethods::Identifier.new("/b/spec.rb",
                                               10,
                                               "group description",
                                               "description")

          id1.should == id2
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
jperkins-deep_test-1.2.2 spec/deep_test/spec/extensions/example_methods_spec.rb
jstorimer-deep-test-1.4.0 spec/deep_test/spec/extensions/example_methods_spec.rb
jstorimer-deep-test-1.3.0 spec/deep_test/spec/extensions/example_methods_spec.rb
jstorimer-deep-test-1.2.0 spec/deep_test/spec/extensions/example_methods_spec.rb
jstorimer-deep-test-1.1.0 spec/deep_test/spec/extensions/example_methods_spec.rb
jstorimer-deep-test-1.0.0 spec/deep_test/spec/extensions/example_methods_spec.rb