Sha256: 6aa66590c9cfb9ae7bc4a28c9d8072eb50e9c4b8a302d43432bbca0ab1e0b63d

Contents?: true

Size: 1.27 KB

Versions: 16

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

describe "env cli" do
  describe "bulk cmd" do
    before(:each) do
      FakeFS::FileSystem.clear
      FakeFS.activate!
      File.open(".rbenv-vars.example", "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::Modes::Env).to receive(:select_stage)

      Negroku::Modes::Env.bulk
    end

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

      Negroku::Modes::Env.bulk "beta"
    end

    it "selects the stage and calls rbenv:vars:set with the vars" do
      allow(Negroku::Modes::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:set", "USER=emilio", "PASSWORD=123")

      Negroku::Modes::Env.bulk "beta"
    end

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
negroku-2.8.6 spec/lib/modes/env_spec.rb
negroku-2.8.5 spec/lib/modes/env_spec.rb
negroku-2.8.4 spec/lib/modes/env_spec.rb
negroku-2.8.3 spec/lib/modes/env_spec.rb
negroku-2.8.2 spec/lib/modes/env_spec.rb
negroku-2.8.1 spec/lib/modes/env_spec.rb
negroku-2.8.0 spec/lib/modes/env_spec.rb
negroku-2.7.1 spec/lib/modes/env_spec.rb
negroku-2.7.0 spec/lib/modes/env_spec.rb
negroku-2.6.0 spec/lib/modes/env_spec.rb
negroku-2.5.5 spec/lib/modes/env_spec.rb
negroku-2.5.4 spec/lib/modes/env_spec.rb
negroku-2.5.3 spec/lib/modes/env_spec.rb
negroku-2.5.2 spec/lib/modes/env_spec.rb
negroku-2.5.1 spec/lib/modes/env_spec.rb
negroku-2.5.0 spec/lib/modes/env_spec.rb