Sha256: 2960af11eebe213d4dd5f2772ba87ca6d33630203593f13dc34616ccef1bf3c8

Contents?: true

Size: 1.82 KB

Versions: 12

Compression:

Stored size: 1.82 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)
    mapper.map_src_paths(['/src_dir/foo']).should == ['/__src__/foo']
    mapper.map_src_paths(['foo/bar']).should == ['/__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)
    mapper.map_spec_paths(['/spec_dir/foo']).should == ['/__spec__/foo']
    mapper.map_spec_paths(['foo/bar']).should == ['/__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)
    mapper.map_jasmine_paths(['/jasmine_dir/foo']).should == ['/__jasmine__/foo']
    mapper.map_jasmine_paths(['foo/bar']).should == ['/__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)
    mapper.map_boot_paths(['/boot_dir/foo']).should == ['/__boot__/foo']
    mapper.map_boot_paths(['foo/bar']).should == ['/__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)
    mapper.map_src_paths(['/src_dir/foo']).should == ['/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)
    mapper.map_src_paths(['/app/assets/application.js']).should == ['/assets/application.js']
  end
end

Version data entries

12 entries across 10 versions & 2 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/jasmine-2.5.2/spec/path_mapper_spec.rb
tdiary-5.0.5 vendor/bundle/gems/jasmine-2.5.2/spec/path_mapper_spec.rb
tdiary-5.0.5 vendor/bundle/gems/jasmine-2.6.0/spec/path_mapper_spec.rb
jasmine-2.6.0 spec/path_mapper_spec.rb
tdiary-5.0.4 vendor/bundle/gems/jasmine-2.5.2/spec/path_mapper_spec.rb
jasmine-2.5.2 spec/path_mapper_spec.rb
tdiary-5.0.2 vendor/bundle/gems/jasmine-2.4.0/spec/path_mapper_spec.rb
jasmine-2.5.1 spec/path_mapper_spec.rb
jasmine-2.5.0 spec/path_mapper_spec.rb
tdiary-5.0.1 vendor/bundle/gems/jasmine-2.4.0/spec/path_mapper_spec.rb
jasmine-2.4.0 spec/path_mapper_spec.rb
jasmine-2.3.1 spec/path_mapper_spec.rb