Sha256: 1c679ad6c83c9ae6e66299b9cea16737c554e4f870c9fd7630ab8149088e76a9

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe WhippedCream::Deployer do
  subject { deployer }
  let(:deployer) { described_class.new(plugin_filename, pi_address) }

  let(:plugin_filename) { 'demo.rb' }
  let(:pi_address) { '192.168.0.123' }

  let(:net_ssh_double) {
    double(Net::SSH, exec!: nil, open_channel: double(wait: nil))
  }

  before do
    deployer.stub :scp_copy
    deployer.stub :ssh_exec
  end

  its(:plugin_filename) { should eq(plugin_filename) }
  its(:pi_address) { should eq(pi_address) }

  describe "#scp" do
    it "tries to connect with pi:raspberry" do
      expect(Net::SCP).to receive(:start).with(
        pi_address, 'pi', password: 'raspberry'
      )

      deployer.scp
    end
  end

  describe "#ssh" do
    it "tries to connect with pi:raspberry" do
      expect(Net::SSH).to receive(:start).with(
        pi_address, 'pi', password: 'raspberry'
      )

      deployer.ssh
    end
  end

  describe "#deploy" do
    subject(:deploy) { deployer.deploy }

    it "bootstraps the Pi" do
      expect(deployer).to receive(:bootstrap)
      expect(deployer).to receive(:copy_plugin)
      expect(deployer).to receive(:kill_all_plugins)
      expect(deployer).to receive(:run_plugin)

      deploy
    end

    # xit "prompts the user for a password on failure"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whipped-cream-0.0.1 spec/lib/whipped-cream/deployer_spec.rb
whipped-cream-0.0.1pre5 spec/lib/whipped-cream/deployer_spec.rb
whipped-cream-0.0.1pre4 spec/lib/whipped-cream/deployer_spec.rb
whipped-cream-0.0.1pre3 spec/lib/whipped-cream/deployer_spec.rb
whipped-cream-0.0.1pre2 spec/lib/whipped-cream/deployer_spec.rb