Sha256: c6bcf72000ed3bf39b2874833a789d613d6c39c859a1dce1e28264befc2fa807

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

describe Xcmonkey do
  describe Xcmonkey::Xcmonkey do
    let(:params) { { udid: '123', bundle_id: 'example.com.app', duration: 10 } }
    let(:duration_error_msg) { 'Duration must be Integer and not less than 1 second' }

    it 'verifies gestures' do
      gestures = described_class.new(params).gestures
      expect(gestures) =~ [:swipe, :precise_tap, :blind_tap]
    end

    it 'verifies required params' do
      expect(Logger).not_to receive(:error)
      described_class.new(params)
    end

    it 'verifies `udid` param is required' do
      params[:udid] = nil
      expect(Logger).to receive(:error).with('UDID should be provided')
      described_class.new(params)
    end

    it 'verifies `bundle_id` param is required' do
      params[:bundle_id] = nil
      expect(Logger).to receive(:error).with('Bundle identifier should be provided')
      described_class.new(params)
    end

    it 'verifies `duration` param is required' do
      params[:duration] = nil
      expect(Logger).to receive(:error).with(duration_error_msg)
      described_class.new(params)
    end

    it 'verifies `duration` param cannot be equal to zero' do
      params[:duration] = 0
      expect(Logger).to receive(:error).with(duration_error_msg)
      described_class.new(params)
    end

    it 'verifies `duration` param cannot be negative' do
      params[:duration] = -1
      expect(Logger).to receive(:error).with(duration_error_msg)
      described_class.new(params)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcmonkey-0.1.2 spec/xcmonkey_spec.rb
xcmonkey-0.1.1 spec/xcmonkey_spec.rb
xcmonkey-0.1.0 spec/xcmonkey_spec.rb