Sha256: 7bbe2eb3bfa7468603701b930cf21da180c2f0308edfcd98018588d6098c4c79

Contents?: true

Size: 1.85 KB

Versions: 53

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'

describe Jasmine::PathMapper do
  it "correctly remaps src files" do
    config = double(:config, :src_dir => '/src_dir', :src_path => '/__src__')
    mapper = Jasmine::PathMapper.new(config)
    expect(mapper.map_src_paths(['/src_dir/foo'])).to eq ['/__src__/foo']
    expect(mapper.map_src_paths(['foo/bar'])).to eq ['/__src__/foo/bar']
  end
  it "correctly remaps spec files" do
    config = double(:config, :spec_dir => '/spec_dir', :spec_path => '/__spec__')
    mapper = Jasmine::PathMapper.new(config)
    expect(mapper.map_spec_paths(['/spec_dir/foo'])).to eq ['/__spec__/foo']
    expect(mapper.map_spec_paths(['foo/bar'])).to eq ['/__spec__/foo/bar']
  end
  it "correctly remaps jasmine files" do
    config = double(:config, :jasmine_dir => '/jasmine_dir', :jasmine_path => '/__jasmine__')
    mapper = Jasmine::PathMapper.new(config)
    expect(mapper.map_jasmine_paths(['/jasmine_dir/foo'])).to eq ['/__jasmine__/foo']
    expect(mapper.map_jasmine_paths(['foo/bar'])).to eq ['/__jasmine__/foo/bar']
  end
  it "correctly remaps boot files" do
    config = double(:config, :boot_dir => '/boot_dir', :boot_path => '/__boot__')
    mapper = Jasmine::PathMapper.new(config)
    expect(mapper.map_boot_paths(['/boot_dir/foo'])).to eq ['/__boot__/foo']
    expect(mapper.map_boot_paths(['foo/bar'])).to eq ['/__boot__/foo/bar']
  end
  it "handles edge case where dir == path" do
    config = double(:config, :src_dir => '/src_dir', :src_path => '/src_dir')
    mapper = Jasmine::PathMapper.new(config)
    expect(mapper.map_src_paths(['/src_dir/foo'])).to eq ['/src_dir/foo']
  end
  it 'handles edge case with multiple instances of src dir' do
    config = double(:config, :src_dir => '/app', :src_path => '/')
    mapper = Jasmine::PathMapper.new(config)
    expect(mapper.map_src_paths(['/app/assets/application.js'])).to eq ['/assets/application.js']
  end
end

Version data entries

53 entries across 40 versions & 2 rubygems

Version Path
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
jasmine-3.99.0 spec/path_mapper_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
jasmine-3.10.0 spec/path_mapper_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
jasmine-3.9.2 spec/path_mapper_spec.rb
jasmine-3.9.1 spec/path_mapper_spec.rb
jasmine-3.9.0 spec/path_mapper_spec.rb
jasmine-3.8.1 spec/path_mapper_spec.rb
jasmine-3.8.0 spec/path_mapper_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/jasmine-2.99.0/spec/path_mapper_spec.rb