Sha256: d8db76183c0ba71658f5704050ff267df47f4e61c07269db396491461421b76e

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Pingo do
  it 'has a version number' do
    expect(Pingo::VERSION).not_to be_nil
  end

  describe "#sound!" do
    let(:client) { Pingo::Client.new(model_name) }

    context 'valid id & pass' do
      before { set_valid_env }

      context 'valid model_name' do
        let(:model_name) { "5s" }

        it 'should return device_id' do
          VCR.use_cassette 'valid_interaction' do
            expect(client.sound!).not_to be_nil
          end
        end
      end

      context 'invalid model_name' do
        let(:model_name) { "100s" }

        it 'should not return device_id' do
          VCR.use_cassette 'valid_interaction' do
            expect { client.sound! }.to raise_error(RuntimeError, "Not found your device(iPhone#{model_name})")
          end
        end
      end
    end

    context 'invalid id & pass' do
      before { set_invalid_env }

      context 'valid model_name' do
        let(:model_name) { "5s" }

        it 'should return device_id' do
          VCR.use_cassette 'invalid_interaction' do
            expect { client.sound! }.to raise_error(RuntimeError, "401:Unauthorized")
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pingo-1.1.0 spec/pingo_spec.rb