Sha256: 02fd172d7d8e8bb66a8df8b1b1488811685bc292c3b95e5775d52495366192e6

Contents?: true

Size: 1.7 KB

Versions: 33

Compression:

Stored size: 1.7 KB

Contents

require "spec_helper"

module CF::Start
  describe TargetPrettifier do
    let(:user) do
      build(:user).tap { |u| u.stub(:email => 'user@example.com') }
    end
    let(:space) { build(:space) }
    let(:organization) { build(:organization) }
    let(:target) { "http://example.com" }
    let(:client) do
      double(:client,
             target: target,
             current_user: user,
             current_organization: organization,
             current_space: space,
             version: 2
      )
    end
    let(:outputter) { double(:outputter, line: nil, fail: nil) }

    before do
      outputter.stub(:c) { |to_colorize| to_colorize }
    end

    describe "displaying the target (no args)" do
      it "prints things nicely" do
        TargetPrettifier.prettify(client, outputter)
        desired_result = <<-STR
Target Information (where will apps be pushed):
  CF instance: #{client.target} (API version: 2)
  user: #{user.email}
  target app space: #{space.name} (org: #{organization.name})
        STR
        desired_result.each_line do |line|
          outputter.should have_received(:line).with(line.chomp)
        end
      end

      context "when nothing is specified" do
        let(:user) { nil }
        let(:space) { nil }
        let(:organization) { nil }

        it "prints things nicely" do
          TargetPrettifier.prettify(client, outputter)
          desired_result = <<-STR
Target Information (where will apps be pushed):
  CF instance: http://example.com (API version: 2)
  user: N/A
  target app space: N/A (org: N/A)
          STR
          desired_result.each_line do |line|
            outputter.should have_received(:line).with(line.chomp)
          end
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
cf-5.2.1.rc7 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.2.1.rc6 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.2.1.rc5 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.2.1.rc4 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.2.1.rc3 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.2.1.rc2 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.2.0 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.1.0.rc1 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.0.0.rc4 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.0.0.rc3 spec/cf/cli/start/target_prettifier_spec.rb
cf-5.0.0.rc1 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.9.rc5 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.9.rc3 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.10.rc2 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.10.rc1 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.9.rc2 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.8 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.8.rc2 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.8.rc1 spec/cf/cli/start/target_prettifier_spec.rb
cf-4.2.7 spec/cf/cli/start/target_prettifier_spec.rb