Sha256: 4bfeeace3b7fc73c290592bec3d374a1886fab5a5bbffc9c6f0d08ab0b73e091

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

module LicenseFinder
  describe Bower do
    describe '.current_packages' do
      it 'lists all the current packages' do
        json = <<-resp
{
  "dependencies": {
    "dependency-library": {
      "canonicalDir": "/path/to/thing",
      "pkgMeta": {
        "name": "dependency-library",
        "description": "description",
        "version": "1.3.3.7",
        "main": "normalize.css"
      }
    },
    "another-dependency": {
      "canonicalDir": "/path/to/thing2",
      "pkgMeta": {
        "name": "another-dependency",
        "description": "description2",
        "version": "4.2",
        "main": "denormalize.css"
      }
    }
  }
}
        resp
        allow(Bower).to receive(:`).with(/bower/).and_return(json)

        current_packages = Bower.current_packages

        expect(current_packages.size).to eq(2)
        expect(current_packages.first).to be_a(Package)
      end
    end

    describe '.active?' do
      let(:package) { double(:package_file) }

      before do
        Bower.stub(package_path: package)
      end

      it 'is true with a bower.json file' do
        package.stub(:exist? => true)
        expect(Bower).to be_active
      end

      it 'is false without a bower.json file' do
        package.stub(:exist? => false)
        expect(Bower).to_not be_active
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
license_finder-1.1.1-java spec/lib/license_finder/package_managers/bower_spec.rb
license_finder-1.1.1 spec/lib/license_finder/package_managers/bower_spec.rb
license_finder-1.1.0 spec/lib/license_finder/package_managers/bower_spec.rb
license_finder-1.0.1 spec/lib/license_finder/package_managers/bower_spec.rb
license_finder-1.0.0.1 spec/lib/license_finder/package_managers/bower_spec.rb