Sha256: d2eb7e4e4b0f09b0bbbca5c24f08d606739e83af032fc77dc3d49f5c5f2d87f8

Contents?: true

Size: 1.67 KB

Versions: 9

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'
require 'natives/apps/list'

describe Natives::Apps::List do
  context "given catalog entry names" do
    it "lists native packages" do
      catalog_name = 'rubygems'
      entry_names = %w(sqlite3 capybara-webkit nokogiri curb)

      catalog = double()
      catalog.should_receive(:native_packages_for).
        with(entry_names).
        and_return(%w(foo bar spam))

      host_detection = double()
      host_detection.should_receive(:platform)
      host_detection.should_receive(:platform_version)
      host_detection.should_receive(:package_provider)

      list = Natives::Apps::List.new
      list.stub(new_catalog: catalog)
      list.stub(new_host_detection: host_detection)

      packages = list.natives_for(catalog_name, entry_names)

      expect(packages).to eq %w(foo bar spam)
    end
  end

  context "given a gemfile path" do
    it "lists native packages" do
      gemfile_path = 'path/to/gemfile'
      list = Natives::Apps::List.new

      gemfile_viewer = double()
      gemfile_viewer.should_receive(:gem_names).
        and_return(%w(gem1 gem2 gem3))

      host_detection = double()
      host_detection.should_receive(:platform)
      host_detection.should_receive(:platform_version)
      host_detection.should_receive(:package_provider)

      catalog = double()
      catalog.should_receive(:native_packages_for).
        with(%w(gem1 gem2 gem3)).
        and_return(%w(foo bar spam))

      list.stub(new_gemfile_viewer: gemfile_viewer)
      list.stub(new_catalog: catalog)
      list.stub(new_host_detection: host_detection)

      packages= list.natives_for_gemfile(gemfile_path)

      expect(packages).to eq %w(foo bar spam)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
natives-0.6.2 spec/natives/apps/list_spec.rb
natives-0.6.1 spec/natives/apps/list_spec.rb
natives-0.6.0 spec/natives/apps/list_spec.rb
natives-0.5.5 spec/natives/apps/list_spec.rb
natives-0.5.4 spec/natives/apps/list_spec.rb
natives-0.5.3 spec/natives/apps/list_spec.rb
natives-0.5.2 spec/natives/apps/list_spec.rb
natives-0.5.1 spec/natives/apps/list_spec.rb
natives-0.5.0 spec/natives/apps/list_spec.rb