Sha256: 135be897d99290bb3a2206bbb0dc7eb84789f6fd839a3750501ffcc3b8694fd4

Contents?: true

Size: 1.32 KB

Versions: 55

Compression:

Stored size: 1.32 KB

Contents

if RUBY_PLATFORM != 'opal'
  require 'volt/server/rack/component_paths'

  describe Volt::ComponentPaths do
    before do
      spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')

      path_to_main = File.join(File.dirname(__FILE__), '../../apps/file_loading/app/main')
      @component_paths = Volt::ComponentPaths.new(spec_app_root)
    end

    it 'should return the paths to all app folders' do
      match_count = 0
      @component_paths.app_folders do |app_folder|
        if app_folder[/spec\/apps\/file_loading\/app$/] || app_folder[/spec\/apps\/file_loading\/vendor\/app$/]
          match_count += 1
        end
      end

      expect(match_count).to eq(2)
    end

    it 'should return the path to a component' do
      main_path = @component_paths.component_paths('main').first
      expect(main_path).to match(/spec\/apps\/file_loading\/app\/main$/)
    end

    it 'should not return paths to non-volt gems' do
      Gem.loaded_specs['fake-gem'] = Gem::Specification.new do |s|
        s.name = 'fake-gem'
        s.version = Gem::Version.new('1.0')
        s.full_gem_path = '/home/volt/projects/volt-app'
      end
      app_folders = @component_paths.app_folders { |f| f }
      expect(app_folders).to_not include('/home/volt/projects/volt-app/app')
      Gem.loaded_specs.delete 'fake-gem'
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/server/rack/component_paths_spec.rb
volt-0.9.7.pre7 spec/server/rack/component_paths_spec.rb
volt-0.9.7.pre6 spec/server/rack/component_paths_spec.rb
volt-0.9.7.pre5 spec/server/rack/component_paths_spec.rb
volt-0.9.7.pre3 spec/server/rack/component_paths_spec.rb
volt-0.9.7.pre2 spec/server/rack/component_paths_spec.rb
volt-0.9.6 spec/server/rack/component_paths_spec.rb
volt-0.9.6.pre3 spec/server/rack/component_paths_spec.rb
volt-0.9.6.pre2 spec/server/rack/component_paths_spec.rb
volt-0.9.6.pre1 spec/server/rack/component_paths_spec.rb
volt-0.9.5 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre12 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre11 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre9 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre8 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre7 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre6 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre5 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre4 spec/server/rack/component_paths_spec.rb
volt-0.9.5.pre3 spec/server/rack/component_paths_spec.rb