Sha256: 451e38312afcd17f4c6efd21488c2b86141ddf04e85a3f32780b01a2da470b6e

Contents?: true

Size: 1.58 KB

Versions: 17

Compression:

Stored size: 1.58 KB

Contents

require "pathname"
require_relative "../../spec_helper.rb"

describe Rsense::Server::LoadPath do
  it "lists loads paths" do
    Rsense::Server::LoadPath.stub :fetch,["/some/path/to/load"] do
      Rsense::Server::LoadPath.paths.first.must_match(/\/some\/path\/to\/load/)
    end
  end

  it "does not list paths inside a jar" do
    Rsense::Server::LoadPath.stub :fetch, ["file:path/in/jar"] do
      Rsense::Server::LoadPath.paths.wont_include("file:path/in/jar")
    end
  end

  describe "with project" do
    ProjectMock = Struct.new(:path)

    before do
      @proj_path = "spec/fixtures/load_path_fixture"
      @project = ProjectMock.new(@proj_path)
    end

    it "checks for a Gemfile.lock" do
      Rsense::Server::LoadPath.find_gemfile(@project.path).to_s.must_match(/Gemfile/)
    end

    it "checks paths for correct version" do
      fake_paths = ["1", "2", "3"]
      checked = Rsense::Server::LoadPath.check_version(fake_paths, "2")
      checked.size.must_equal(1)
      checked.must_include("2")
      checked.wont_include("1")
      checked.wont_include("3")
    end

    it "returns a list of Gems" do
      class SpecMock
        def name
          "mock"
        end

        def version
          "2"
        end
      end

      lfile = Object.new

      def lfile.specs
        [SpecMock.new]
      end

      Gem.stub :find_files, ["/stubbed/path-2"] do
        ret_gems = Rsense::Server::LoadPath.gem_info(lfile).first
        ret_gems.name.must_match(/mock/)
        ret_gems.full_name.must_match(/mock-2/)
        ret_gems.path.first.must_match(/stubbed/)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rsense-server-0.5.18 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.17 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.16 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.15 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.14 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.13 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.12 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.11 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.10 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.9 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.8 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.7 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.6 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.5 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.4 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.2 spec/rsense/server/load_path_spec.rb
rsense-server-0.5.0 spec/rsense/server/load_path_spec.rb