Sha256: c3feece0d89ff6cae801ed6cf36179328678da1f7a7638d996bcf404e3971ff1

Contents?: true

Size: 980 Bytes

Versions: 64

Compression:

Stored size: 980 Bytes

Contents

require "spec_helper"

describe Brightbox::BBConfig do
  let(:expected_token) { random_token }

  before do
    @config = config_from_contents(contents)
  end

  describe "#refresh_token" do
    context "when value has been set" do
      let(:contents) { "" }

      it "returns set value" do
        @config.refresh_token = expected_token
        expect(@config.refresh_token).to eql(expected_token)
      end
    end

    context "when cached value exists" do
      let(:contents) do
        <<-EOS
        [app-12345]
        client_id = app-12345
        EOS
      end

      it "returns value from config" do
        cache_refresh_token(@config, expected_token)
        expect(@config.refresh_token).to eql(expected_token)
      end
    end

    context "when cache files does not exist" do
      let(:contents) do
        <<-EOS
        [app-12345]
        EOS
      end

      it "returns nil" do
        expect(@config.refresh_token).to be_nil
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
brightbox-cli-5.0.0.rc2 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-5.0.0.rc1 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-5.0.0.alpha spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.8.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.7.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.6.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.5.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.5.0.rc1 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.4.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.3.2 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.3.1 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.3.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.2.1 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.2.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.1.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.0.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-4.0.0.rc2 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-3.3.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-3.2.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb
brightbox-cli-3.1.0 spec/unit/brightbox/bb_config/refresh_token_spec.rb