Sha256: 0d237b25f154ba6553ac9b7a68440b54e8854891613e212e5fe4dddd0bb480dd

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../../unit_spec_helper")

module JsTestCore
  module Resources
    describe Dir do
      attr_reader :dir, :absolute_path, :relative_path

      describe "#locate" do
        before do
          @absolute_path = core_path
          @relative_path = "/core"
          @dir = Resources::Dir.new(absolute_path, relative_path)
        end

        describe "when passed a name of a real file" do
          it "returns a Resources::File representing it" do
            file = dir.locate("JsTestCore.css")
            file.relative_path.should == "/core/JsTestCore.css"
            file.absolute_path.should == "#{core_path}/JsTestCore.css"
          end
        end
      end

      describe "#glob" do
        before do
          @absolute_path = spec_root_path
          @relative_path = "/specs"
          @dir = Resources::Dir.new(absolute_path, relative_path)
        end

        it "returns an array of matching Files under this directory with the correct relative paths" do
          globbed_files = dir.glob("/**/*_spec.js")

          globbed_files.size.should == 3
          globbed_files.should contain_spec_file_with_correct_paths("/failing_spec.js")
          globbed_files.should contain_spec_file_with_correct_paths("/foo/failing_spec.js")
          globbed_files.should contain_spec_file_with_correct_paths("/foo/passing_spec.js")
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
btakita-screw-unit-server-0.3.0 vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb
btakita-screw_unit-0.1.0 vendor/js_test_core/spec/unit/js_spec/resources/dir_spec.rb
btakita-screw_unit-0.3.0 vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb
js_test_core-0.1.1 spec/unit/js_spec/resources/dir_spec.rb
screw-unit-server-0.3.0 vendor/js-test-core/spec/unit/js_test_core/resources/dir_spec.rb