Sha256: 94e4882ace9ab4374f7fc4203425139c8c86e34198dbd4fe522383f177a2a412

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'

describe PhoneGap::Build::Credentials do

  subject { PhoneGap::Build::Credentials .instance }

  describe '#load' do

    let(:config_file) { File.expand_path('config/phonegap.yml', ROOT_DIR) }

    before do
      File.stub(:exists?).with(config_file).and_return true
    end

    it 'tries to load a phonegap config file' do
      expect(YAML).to receive(:load_file).with(config_file).and_return({})
      subject.load
    end

    context 'if a config file exists' do

      before do
        YAML.stub(:load_file).and_return({'token' => 'BATMAN'})
      end

      it 'populates the credentials using values from the config file' do
        subject.load
        expect(subject.token).to eq 'BATMAN'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phone_gap-build-0.6.1 spec/phone_gap/build/credentials_spec.rb
phone_gap-build-0.6.0 spec/phone_gap/build/credentials_spec.rb
phone_gap-build-0.5.1 spec/phone_gap/build/credentials_spec.rb
phone_gap-build-0.5.0 spec/phone_gap/build/credentials_spec.rb
phone_gap-build-0.4.0 spec/phone_gap/build/credentials_spec.rb