Sha256: 1f8806982978be4173232436a04f385e4f01a5fc4ef4e5fb37a5983975b7db36

Contents?: true

Size: 1.47 KB

Versions: 8

Compression:

Stored size: 1.47 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'pluginmanager/main'

describe LogStash::PluginManager::Update do
  let(:cmd)     { LogStash::PluginManager::Update.new("update") }
  let(:sources) { cmd.gemfile.gemset.sources }

  before(:each) do
    expect(cmd).to receive(:find_latest_gem_specs).and_return({})
    allow(cmd).to receive(:warn_local_gems).and_return(nil)
    expect(cmd).to receive(:display_updated_plugins).and_return(nil)
    expect_any_instance_of(LogStash::Bundler).to receive(:invoke!).with(:clean => true)
  end

  it "pass all gem sources to the bundle update command" do
    sources = cmd.gemfile.gemset.sources
    expect_any_instance_of(LogStash::Bundler).to receive(:invoke!).with(:update => [], :rubygems_source => sources)
    cmd.execute
  end

  context "when skipping validation" do
    let(:cmd)    { LogStash::PluginManager::Update.new("update") }
    let(:plugin) { OpenStruct.new(:name => "dummy", :options => {} ) }

    before(:each) do
      expect(cmd.gemfile).to receive(:find).with(plugin).and_return(plugin)
      expect(cmd.gemfile).to receive(:save).and_return(nil)
      expect(cmd).to receive(:plugins_to_update).and_return([plugin])
      expect_any_instance_of(LogStash::Bundler).to receive(:invoke!).with(:update => [plugin], :rubygems_source => sources).and_return(nil)
    end

    it "skips version verification when ask for it" do
      cmd.verify = false
      expect(cmd).to_not receive(:validates_version)
      cmd.execute
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
logstash-core-2.1.3-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.2-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.2.snapshot1-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.1-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.0-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.0.snapshot4-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.0.snapshot3-java spec/plugin_manager/update_spec.rb
logstash-core-2.1.0.snapshot2-java spec/plugin_manager/update_spec.rb