Sha256: 1c2a02b24cdebabc8e31a436cc3630289179f7638fac9c5052f288d7d24fb758

Contents?: true

Size: 1.72 KB

Versions: 72

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'
require 'dpl/provider/firebase'

describe DPL::Provider::Firebase do
  subject :provider do
    described_class.new DummyContext.new, :token => 'abc123'
  end

  describe "#check_auth" do
    it 'should require a token if no FIREBASE_TOKEN is set' do
      provider.options.update(:token => nil)
      expect{ provider.check_auth }.to raise_error("must supply token option or FIREBASE_TOKEN environment variable")
    end

    it 'should allow no token if FIREBASE_TOKEN is set' do
      provider.options.update(:token => nil)
      provider.context.env['FIREBASE_TOKEN'] = 'abc123'
      expect{ provider.check_auth }.not_to raise_error
    end
  end

  describe "#push_app" do
    it 'should include the project specified' do
      provider.options.update(:project => 'myapp-dev')
      expect(provider.context).to receive(:shell).with("firebase deploy --non-interactive --project myapp-dev --token 'abc123'").and_return(true)
      provider.push_app
    end

    it 'should include the message specified' do
      provider.options.update(:message => 'test message')
      expect(provider.context).to receive(:shell).with("firebase deploy --non-interactive --message 'test message' --token 'abc123'").and_return(true)
      provider.push_app
    end

    it 'should default to no project override' do
      expect(provider.context).to receive(:shell).with("firebase deploy --non-interactive --token 'abc123'").and_return(true)
      provider.push_app
    end

    it 'should report an error when deployment fails' do
      expect(provider.context).to receive(:shell).with("firebase deploy --non-interactive --token 'abc123'").and_return(false)
      expect {
        provider.push_app
      }.to raise_error(DPL::Error)
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
dpl-firebase-1.10.11.travis.3497.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.10 spec/provider/firebase_spec.rb
dpl-firebase-1.10.9 spec/provider/firebase_spec.rb
dpl-firebase-1.10.9.travis.3280.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.9.travis.3258.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.8 spec/provider/firebase_spec.rb
dpl-firebase-1.10.8.travis.3236.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.8.travis.3216.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7 spec/provider/firebase_spec.rb
dpl-firebase-1.10.8.travis.3178.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7.travis.3177.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7.travis.3151.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7.travis.3128.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7.travis.3125.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7.travis.3126.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.7.travis.3120.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.6.travis.3119.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.6 spec/provider/firebase_spec.rb
dpl-firebase-1.10.6.travis.3118.5 spec/provider/firebase_spec.rb
dpl-firebase-1.10.6.travis.3114.5 spec/provider/firebase_spec.rb