Sha256: 925fbcbf034765eecb23fb48137e0e998c0f51ae5bedf5890fdc76e386966c8e

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require "spec_helper"

describe CFoundry::V2::App do
  let(:client) { fake_client }

  describe "environment" do
    let(:app) { fake :app, :env => { "FOO" => "1" } }

    it "returns a hash-like object" do
      expect(app.env["FOO"]).to eq "1"
    end

    describe "converting keys and values to strings" do
      let(:app) { fake :app, :env => { :FOO => 1 } }

      it "converts keys and values to strings" do
        expect(app.env.to_hash).to eq("FOO" => "1")
      end
    end

    context "when changes are made to the hash-like object" do
      it "reflects the changes in .env" do
        expect {
          app.env["BAR"] = "2"
        }.to change { app.env.to_hash }.from("FOO" => "1").to("FOO" => "1", "BAR" => "2")
      end
    end

    context "when the env is set to something else" do
      it "reflects the changes in .env" do
        expect {
          app.env = { "BAR" => "2" }
        }.to change { app.env.to_hash }.from("FOO" => "1").to("BAR" => "2")
      end
    end
  end

  describe "#summarize!" do
    let(:app) { fake :app }

    it "assigns :instances as #total_instances" do
      stub(app).summary { { :instances => 4 } }

      app.summarize!

      expect(app.total_instances).to eq(4)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cfoundry-0.5.1.rc2 spec/cfoundry/v2/app_spec.rb
cfoundry-0.5.1.rc1 spec/cfoundry/v2/app_spec.rb