Sha256: a647ffd02fa6bd376844127a58b84cb7c6414cc91ac7f12e290e3fa8636a690b

Contents?: true

Size: 1.27 KB

Versions: 20

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

module Ask;end
module Capistrano
  module Application;end
end

describe "env cli" do
  describe "bulk cmd" do
    before(:each) do
      FakeFS::FileSystem.clear
      FakeFS.activate!
      File.open(".rbenv-vars", "w") do |file|
        file.puts "#COMMENTED=HI"
        file.puts "SERVER=platan.us"
        file.puts "PASSWORD=oops"
      end
    end

    after(:each) do
      FakeFS.deactivate!
    end

    it "asks for stage if not selected" do
      expect(Negroku::Env).to receive(:select_stage)

      Negroku::Env.bulk
    end

    it "use selected stage if passed" do
      allow(Negroku::Env).to receive(:select_variables).and_return([])
      expect(Negroku::Env).not_to receive(:select_stage)

      Negroku::Env.bulk "beta"
    end

    it "selects the stage and calls rbenv:vars:add with the vars" do
      allow(Negroku::Env).to receive(:select_variables).and_return({USER: "emilio", PASSWORD: "123"})
      expect(Capistrano::Application).to receive(:invoke).with("beta")
      expect(Capistrano::Application).to receive(:invoke).with("rbenv:vars:add", "USER=emilio", "PASSWORD=123")

      Negroku::Env.bulk "beta"
    end

    it "returns the list of variables" do
      expect{|b| Negroku::Env.get_variables(&b)}.to yield_control.twice
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
negroku-2.4.2 spec/lib/cli/env_spec.rb
negroku-2.4.1 spec/lib/cli/env_spec.rb
negroku-2.4.0 spec/lib/cli/env_spec.rb
negroku-2.3.5 spec/lib/cli/env_spec.rb
negroku-2.3.4 spec/lib/cli/env_spec.rb
negroku-2.3.3 spec/lib/cli/env_spec.rb
negroku-2.3.2 spec/lib/cli/env_spec.rb
negroku-2.3.1 spec/lib/cli/env_spec.rb
negroku-2.3.0 spec/lib/cli/env_spec.rb
negroku-2.2.0 spec/lib/cli/env_spec.rb
negroku-2.1.0 spec/lib/cli/env_spec.rb
negroku-2.0.3 spec/lib/cli/env_spec.rb
negroku-2.0.2 spec/lib/cli/env_spec.rb
negroku-2.0.1 spec/lib/cli/env_spec.rb
negroku-2.0.0 spec/lib/cli/env_spec.rb
negroku-2.0.0.pre7 spec/lib/cli/env_spec.rb
negroku-2.0.0.pre6 spec/lib/cli/env_spec.rb
negroku-2.0.0.pre5 spec/lib/cli/env_spec.rb
negroku-2.0.0.pre4 spec/lib/cli/env_spec.rb
negroku-2.0.0.pre3 spec/lib/cli/env_spec.rb