Sha256: b2e3122a1beac24129b593f763e349d79e10669201e61c81329c0e2a3a5df67b

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require "spec_helper"

describe IOSConfigProfile::BasicPayload do
  class Payload
    include IOSConfigProfile::BasicPayload

    def to_plist
      "payload in plist format"
    end
  end

  let(:payload) { Payload.new }

  describe "#uuid" do
    it "returns a uuid" do
      uuid1 = payload.uuid
      uuid2 = Payload.new.uuid
      expect(uuid1).to_not eq uuid2
    end
  end

  describe '#to_encrypted_payload' do
    let(:payload) { Payload.new }

    subject { payload.to_encrypted_payload }

    it { is_expected.to be_an IOSConfigProfile::EncryptedPayload }
    its(:payload) { should == "payload in plist format" }
  end

  describe '#to_command_payload' do
    let(:payload) { Payload.new }

    subject { payload.to_command_payload }

    it { is_expected.to be_a IOSConfigProfile::CommandPayload }
    its(:command) { should == payload }
  end

  describe "#require_attributes" do
    it "will check for multiple attributes" do
      payload.send(:require_attributes, :to_plist, :uuid)
      expect { payload.send(:require_attributes, :to_plist, :asdf) }.to raise_error NoMethodError
    end
  end

  describe "#require_attribute" do
    it "will raise an error if the name doesn't exist" do
      payload.send(:require_attribute, :to_plist)
      expect { payload.send(:require_attribute, :asdf) }.to raise_error NoMethodError
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ios_config_profile-1.4.1 spec/basic_payload_spec.rb
ios_config_profile-1.4.0 spec/basic_payload_spec.rb
ios_config_profile-1.3.0 spec/basic_payload_spec.rb