Sha256: 79f806eca07aa2d8ca4af52991ee1c05c83e9f405852480b5dab3316d2059bf3

Contents?: true

Size: 826 Bytes

Versions: 3

Compression:

Stored size: 826 Bytes

Contents

require 'spec/spec_helper'

describe EngineAssets::PublicLocator do
  attr_reader :base_path, :full_path, :find_path, :miss_path

  before do
    @base_path = File.join('fixtures', 'public')
    @full_path = File.join(basedir, 'spec', 'support', base_path)
    @find_path = '/javascripts/dual.js'
    @miss_path = '/javascripts/miss.js'

    EngineAssets::PublicLocator.paths << base_path
  end

  describe "#locate" do
    context "when the requested sub-path is located" do
      it "returns the full path to the file" do
        EngineAssets::PublicLocator.locate(find_path).should =~ /#{File.join(base_path, find_path)}/
      end
    end

    context "when the requested sub-path is not located" do
      it "returns nil" do
        EngineAssets::PublicLocator.locate(miss_path).should be_nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
engine-assets-0.3.3 spec/lib/engine_assets/public_locator_spec.rb
engine-assets-0.3.2 spec/lib/engine_assets/public_locator_spec.rb
engine-assets-0.3.1 spec/lib/engine_assets/public_locator_spec.rb