Sha256: 102c58dabe055c0d7b5c510b44dbbc0ce5a6e2ec44b6ff4d59e0b5babe498580

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

describe BubbleWrap::Device::CameraWrapper do
  
  before do
    BW::Device.camera.instance_variable_set(:@front, nil)
    BW::Device.camera.instance_variable_set(:@rear, nil)
  end
  
  describe 'on device with only front facing camera' do
    before do
      UIImagePickerController.instance_eval do
        def isCameraDeviceAvailable(c)
          c == UIImagePickerControllerCameraDeviceFront
        end
      end
    end

    describe '.front?' do
      it 'returns true' do
        BW::Device.camera.front?.should == true
      end
    end

    describe '.rear?' do
      it 'returns false' do
        BW::Device.camera.rear?.should == false
      end
    end
  end

  describe 'on device with only rear facing camera' do
    before do
      UIImagePickerController.instance_eval do
        def isCameraDeviceAvailable(c)
          c == UIImagePickerControllerCameraDeviceRear
        end
      end
    end

    describe '.front?' do
      it 'returns false' do
        BW::Device.camera.front?.should == false
      end
    end

    describe '.rear?' do
      it 'returns true' do
        BW::Device.camera.rear?.should == true
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bubble-wrap-1.4.0 spec/motion/core/device/ios/camera_wrapper_spec.rb
bubble-wrap-1.3.0 spec/motion/core/device/ios/camera_wrapper_spec.rb
bubble-wrap-1.3.0.osx spec/motion/core/device/ios/camera_wrapper_spec.rb
bubble-wrap-1.2.0 spec/motion/core/device/camera_wrapper_spec.rb
bubble-wrap-1.2.0.pre spec/motion/core/device/camera_wrapper_spec.rb
bubble-wrap-1.1.5 spec/motion/core/device/camera_wrapper_spec.rb